Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10948 (closed enhancement: duplicate)

Opened 2 years ago

Last modified 2 years ago

[PATCH] postgresql_adapter support for pg module

Reported by: jdavis Assigned to: bitsweat
Priority: normal Milestone: 2.1
Component: ActiveRecord Version: edge
Severity: normal Keywords: postgresql postgres pg activerecord ruby-pg ruby-postgres
Cc:

Description

The ruby-pg project on rubyforge.org is now the official source for the new "pg" gem (providing "pg" module) as well as the older "postgres" gem (providing "postgres" module) inherited from the ruby-postgres project.

The postgresql_adapter.rb for ActiveRecord requires some modification to support the new "pg" module. I have attached a patch, and it passes "rake test_postgresql" for ActiveRecord.

The new postgresql_adapter.rb tries to load the new "pg" module first, and on LoadError, falls back to the "postgres" module.

Attachments

activerecord-ruby-pg.diff (3.8 kB) - added by jdavis on 02/16/08 00:17:38.
patch for activerecord postgresql_adapter.rb to support "pg" module

Change History

01/31/08 18:07:19 changed by jdavis

Note: for this patch to pass all of the tests with the old "postgres" module, you need to use the latest version. Update to the newest versions of both the "pg" and "postgres" modules, and then this patch will work with either.

02/01/08 18:29:12 changed by pops_head

Looks good, I'll download the patch and try it out.

02/15/08 19:28:13 changed by bitsweat

  • owner changed from core to bitsweat.
  • milestone changed from 2.x to 2.1.

Let's please maintain compatibility with the 'old-school' postgres driver if at all possible.

Consider monkeypatching in compatibility methods if they don't exist, like the mysql adapter does.

02/16/08 00:17:38 changed by jdavis

  • attachment activerecord-ruby-pg.diff added.

patch for activerecord postgresql_adapter.rb to support "pg" module

02/16/08 00:20:02 changed by jdavis

Refactored and added some compatibility aliases, and now this works with the old "postgres" driver version 0.7.1.2006.04.06, as well as "postgres" driver version 0.7.9.2008.01.28, and the "pg" driver.

03/29/08 22:28:47 changed by bitsweat

  • status changed from new to closed.
  • resolution set to duplicate.