Pat Maddox
2006-Mar-05 09:27 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
I wanted to fix some things up in the trunk, so I set up the databases and ran the unit tests. A bunch fail for postgres, and even more error out. I know of two postgresql adapters: postgres-pr and ruby-postgres. Strangely, they each fail different tests. So if I want to fix things up, which one should I be using? For that matter, which adapter should I be using for production? Finding out that the Rails unit tests blow up for postgresql is not very reassuring. Pat
David Mitchell
2006-Mar-05 10:26 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
postgres-pr works very well for me - I''ve got a (private) Rails app that moves loads of data into and out of Postgres with it, and it''s never given me any problem whatsoever. Regards Dave M. On 05/03/06, Pat Maddox <pergesu@gmail.com> wrote:> I wanted to fix some things up in the trunk, so I set up the databases > and ran the unit tests. A bunch fail for postgres, and even more > error out. I know of two postgresql adapters: postgres-pr and > ruby-postgres. Strangely, they each fail different tests. So if I > want to fix things up, which one should I be using? For that matter, > which adapter should I be using for production? Finding out that the > Rails unit tests blow up for postgresql is not very reassuring. > > Pat > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Lugovoi Nikolai
2006-Mar-05 10:33 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
I use ruby-postgres (C binding) - works well for me :) Latest available ruby-postgres-20051221 driver by default internally converts query results and returns Ruby values, not strings. This is convenient when using it outside Rails w/o ActiveRecord. As of rev3772 of rails and ruby-postgres-20051221 I had following 11 test failures: - 8 about type mismatch - expected Time, got DateTime from driver for TIMESTAMP columns. - 2 about type mismatch - expected ''t'', got <true> from driver - 1 related to this ticket: http://dev.rubyonrails.org/ticket/3114 - Failure in test_reset_table_with_non_integer_pk(AdapterTest) [./test/adapter_test.rb:56] If I add to test/connections/native_postgresql/connection.rb: require ''postgres'' PGconn.translate_results = false then driver doesn''t parse query results and only one test fails [./test/adapter_test.rb:56]. On 3/5/06, Pat Maddox <pergesu@gmail.com> wrote:> I wanted to fix some things up in the trunk, so I set up the databases > and ran the unit tests. A bunch fail for postgres, and even more > error out. I know of two postgresql adapters: postgres-pr and > ruby-postgres. Strangely, they each fail different tests. So if I > want to fix things up, which one should I be using? For that matter, > which adapter should I be using for production? Finding out that the > Rails unit tests blow up for postgresql is not very reassuring. > > Pat > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Tom Mornini
2006-Mar-05 18:50 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
On Mar 5, 2006, at 2:33 AM, Lugovoi Nikolai wrote:> I use ruby-postgres (C binding) - works well for me :) > > Latest available ruby-postgres-20051221 driver by default internally > converts query results and returns Ruby values, not strings. > This is convenient when using it outside Rails w/o ActiveRecord.I just tried to update to the suggested version, and it broke tests. It seems that version doesn''t play nicely with migrations. Columns defined nullable (either implicitly or explicity) don''t get created as nullable. I''m curious about your comment on return values. With the release version of the driver: http://ruby.scripting.ca/postgres/archive/ruby-postgres-0.7.1.tar.gz I get true/false for boolean, Date for date columns, and Time for timestamp with Rail 1.0. Perhaps it''s the Rails adapter doing the conversion as opposed to the driver? In short, I''m a big believer in using the latest version, but from my perspective, the release version works perfectly with Rails 1.0, and the snapshot version does not. -- -- Tom Mornini
Lugovoi Nikolai
2006-Mar-06 07:48 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
On 3/5/06, Tom Mornini <tmornini@infomania.com> wrote:> On Mar 5, 2006, at 2:33 AM, Lugovoi Nikolai wrote: > > > I use ruby-postgres (C binding) - works well for me :) > > > > Latest available ruby-postgres-20051221 driver by default internally > > converts query results and returns Ruby values, not strings. > > This is convenient when using it outside Rails w/o ActiveRecord. > > I just tried to update to the suggested version, and it broke tests. > > It seems that version doesn''t play nicely with migrations. > > Columns defined nullable (either implicitly or explicity) don''t get > created as nullable. >I doubt it is driver problem, as migrations are Rails feature. What test failures you had except those I mentioned?> I''m curious about your comment on return values. With the release > version of the driver: > > http://ruby.scripting.ca/postgres/archive/ruby-postgres-0.7.1.tar.gz > > I get true/false for boolean, Date for date columns, and Time for > timestamp with Rail 1.0. Perhaps it''s the Rails adapter doing the > conversion as opposed to the driver? >Yes, ActiveRecord performs conversion if the given value (from driver) is a String. And here is example of difference in driver behaviour: ruby-postgres-0.7.1: c = PGconn.new; c.query("select true, false, 1, 2.4::float, ''test'', now()::date, now()") => [["t", "f", "1", "2.4", "test", "2006-03-06", "2006-03-06 09:39:56.859984+02"]] ruby-postgres-20051221: c = PGconn.new; c.query("select true, false, 1, 2.4::float, ''test'', now()::date, now()") => [[true, false, 1, 2.4, "test", #<Date: 4907601/2,0,2299161>, #<DateTime: 212008390801712003/86400000000,1/12,2299161>]]> In short, I''m a big believer in using the latest version, but from > my perspective, the release version works perfectly with Rails 1.0, > and the snapshot version does not. >As for me, snapshot version works better outside Rails :)
Jay Levitt
2006-Mar-06 13:42 UTC
[Rails] Re: Which postgresql adapter to use for rails core? How about production?
On Sun, 5 Mar 2006 21:26:55 +1100, David Mitchell wrote:> postgres-pr works very well for me - I''ve got a (private) Rails app > that moves loads of data into and out of Postgres with it, and it''s > never given me any problem whatsoever.I''ve had trouble using postgres-pr on Windows with Webrick (development mode, of course) - left running long enough over my VPN, it eventually seems to lose its connection. Of course, I can''t say if that''s postgres-pr or just the protocol itself, since AFAIK Windows still can''t run the C bindings.
Tom Mornini
2006-Mar-06 17:11 UTC
[Rails] Which postgresql adapter to use for rails core? How about production?
On Mar 5, 2006, at 11:48 PM, Lugovoi Nikolai wrote:> On 3/5/06, Tom Mornini <tmornini@infomania.com> wrote: >> On Mar 5, 2006, at 2:33 AM, Lugovoi Nikolai wrote: >> >>> I use ruby-postgres (C binding) - works well for me :) >>> >>> Latest available ruby-postgres-20051221 driver by default internally >>> converts query results and returns Ruby values, not strings. >>> This is convenient when using it outside Rails w/o ActiveRecord. >> >> I just tried to update to the suggested version, and it broke tests. >> >> It seems that version doesn''t play nicely with migrations. >> >> Columns defined nullable (either implicitly or explicity) don''t get >> created as nullable. > > I doubt it is driver problem, as migrations are Rails feature. > What test failures you had except those I mentioned?Well, it''s some sort of problem between the driver and Rails. The same migrations work perfectly with ruby-postgres-0.7.1, but don''t work properly with ruby-postgres-20051221.>> I''m curious about your comment on return values. With the release >> version of the driver: >> >> http://ruby.scripting.ca/postgres/archive/ruby-postgres-0.7.1.tar.gz >> >> I get true/false for boolean, Date for date columns, and Time for >> timestamp with Rail 1.0. Perhaps it''s the Rails adapter doing the >> conversion as opposed to the driver? >> > > Yes, ActiveRecord performs conversion if the given value (from driver) > is a String. > > And here is example of difference in driver behaviour: > > ruby-postgres-0.7.1: > c = PGconn.new; c.query("select true, false, 1, 2.4::float, ''test'', > now()::date, now()") > => [["t", "f", "1", "2.4", "test", "2006-03-06", "2006-03-06 > 09:39:56.859984+02"]] > > ruby-postgres-20051221: > c = PGconn.new; c.query("select true, false, 1, 2.4::float, ''test'', > now()::date, now()") > => [[true, false, 1, 2.4, "test", #<Date: 4907601/2,0,2299161>, > #<DateTime: 212008390801712003/86400000000,1/12,2299161>]] > >> In short, I''m a big believer in using the latest version, but from >> my perspective, the release version works perfectly with Rails 1.0, >> and the snapshot version does not.Yes, outside of Rails having the driver do the conversions would be wonderful. Inside Rails they''re already done, and migrations work with the older version, so I''d recommend the older version under Rails. -- -- Tom Mornini