Pg 0.15.0 Released

pg version 0.15.0 has been released!

Pg is the Ruby interface to the {PostgreSQL
RDBMS}[http://www.postgresql.org/].

It works with {PostgreSQL 8.3 and later}[PostgreSQL Release Support Policy - PostgreSQL wiki].

A small example usage:

#!/usr/bin/env ruby

require ‘pg’

Output a table of current connections to the DB

conn = PG.connect( dbname: ‘sales’ )
conn.exec( “SELECT * FROM pg_stat_activity” ) do |result|
puts " PID | User | Query"
result.each do |row|
puts " %7d | %-16s | %s " %
row.values_at(‘procpid’, ‘usename’, ‘current_query’)
end
end

Changes:

== v0.15.0 [2013-03-03] Michael G. [email protected]

Bugfixes:

  • Fix segfault in PG::Result#field_values when called with non String
    value.
  • Fix encoding of messages delivered by notice callbacks.
  • Fix text encoding for Connection#wait_for_notify and
    Connection#notifies.
  • Fix ‘Bad file descriptor’ problems under Windows: wrong behaviour of
    #wait_for_notify() and timeout handling of #block on Ruby 1.9.

Documentation fixes:

  • conn#socket() can not be used with IO.for_fd() on Windows.

Enhancements:

  • Tested under Ruby 2.0.0p0.
  • Add single row mode of PostgreSQL 9.2.
  • Set fallback_application_name to programm name $0. Thanks to Will
    Leinweber
    for the patch.
  • Release Ruby’s GVL while calls to blocking libpq functions to allow
    better
    concurrency in threaded applications.
  • Refactor different variants of waiting for the connection socket.
  • Make use of rb_thread_fd_select() on Ruby 1.9 and avoid deprecated
    rb_thread_select().
  • Add an example of how to insert array data using a prepared statement
    (#145).
  • Add continous integration tests on travis-ci.org.
  • Add PG::Result#each_row for iterative over result sets by row. Thanks
    to
    Aaron P. for the patch.
  • Add a PG::Connection#socket_io method for fetching a (non-autoclosing)
    IO
    object for the connection’s socket.

Specs:

  • Fix various specs to run on older PostgreSQL and Ruby versions.
  • Avoid fork() in specs to allow usage on Windows and JRuby.