Pg 0.13.0 Released

pg version 0.13.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

In the near future, I’ll also be pushing out new versions of the
‘ruby-pg’ and ‘postgres’ gems which point people to ‘pg’, as the
alternative names are confusing and contain code that hasn’t been
touched in 4+ years. People with dependencies on the existing code
will, of course, continue to be able to install and use the old
versions.

Changes:

v0.13.0 [] Michael G. [email protected]

Reorganization of modules/classes to be better Ruby citizens (with
backward-compatible aliases):

  • Created toplevel namespace ‘PG’ to correspond with the gem name.
  • Renamed PGconn to PG::Connection (with ::PGconn alias)
  • Renamed PGresult to PG::Result (with ::PGresult alias)
  • Renamed PGError to PG::Error (with ::PGError alias)
  • Declare all constants inside PG::Constants, then include them in
    PG::Connection and PG::Result for backward-compatibility, and
    in PG for convenience.
  • Split the extension source up by class/module.
  • Removed old compatibility code for PostgreSQL versions < 8.3

Documentation:

  • Clarified licensing, updated to Ruby 1.9’s license.
  • Merged authors list, added some missing people to the Contributor’s
    list.
  • Cleaned up the sample/ directory
  • Making contact info a bit clearer, link to the Google+ page and
    the mailing list

Enhancements:

  • Added a convenience method: PG.connect → PG::Connection.new

Bugfixes:

  • Fixed LATIN5-LATIN10 Postgres<->Ruby encoding conversions