ruby-pg is now the official postgres ruby gem

ruby-pg is now the official rubyforge project for the “postgres” ruby
gem. See the project here:

http://www.rubyforge.org/projects/ruby-pg

or install the gem directly:

# gem install –remote postgres

The previous project has gone unmaintained for a long time, which lead
to the fork.

This gem includes some important fixes, most notably the ability to
compile against PostgreSQL 8.3.

The gem contains two modules:

  • ‘postgres’ — require this module as before, you can use it without
    making any changes to your application. This is essentially just a fork
    from version 0.7.1.2006.04.06, but contains some important fixes,
    including the ability to build against 8.3.
  • ‘pg’ — a new interface, designed to offer every feature available in
    libpq to Ruby, with a better API. This module is simpler, cleaner, and
    more portable. It is still unstable, so test before using.

PostgreSQL+Ruby users: please test and report any problems. I’d like to
make sure this is as stable as possible, and builds on all necessary
platforms.

One thought on “ruby-pg is now the official postgres ruby gem

  1. See http://wiki.rubyonrails.org/rails/pages/PostgreSQL for more information on how to use this gem.

    Here is what I had to do on mac OS X 10.5 with http://www.postgresqlformac.com/

    The command line switches for the pgsql library locations have have changed, they are now –with-pgsql-include –with-pgsql-lib

    There are now two possible driver targets. I found it easiest to change to the gem source directory
    [/usr/local]/lib/ruby/gems/1.8/gems/postgres-0.7.9.2007.12.22

    and build the driver from its subdirectory compat-ruby-postgres.

    Perhaps someone could clarify the significance of each of the drivers, and how to control which gets built and installed using gem install postgres –