Phoenix Rising
2011-Jul-20 11:04 UTC
PostgreSQL + database.yml - how do I tell it to ignore the fact that other sessions are open in the database?
Since recently switching to PostgreSQL from MySQL, I''ve frequently run into an annoyance that occurs to me I *may* need to adjust in database.yml. Obviously I''d Google for this, but I have no idea what to call this issue. When I run my tests, e.g. "rake test:units", I get a notice that "There are N other session(s) using the database." This is awesome for production environments, but in development, it''s just plain annoying. I''m not sure if this is a warning from the rake task doing the DB drop, or from PostgreSQL itself. How can I get it to just not care in development mode, like MySQL does? Thanks :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2011-Jul-20 11:07 UTC
Re: PostgreSQL + database.yml - how do I tell it to ignore the fact that other sessions are open in the database?
On 20 July 2011 12:04, Phoenix Rising <polarisrising-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Since recently switching to PostgreSQL from MySQL, I''ve frequently run > into an annoyance that occurs to me I *may* need to adjust in > database.yml. Obviously I''d Google for this, but I have no idea what > to call this issue. > >Does this help: http://stackoverflow.com/questions/4977171/rails-test-database-postgresql-errors-os-x -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Phoenix Rising
2011-Jul-20 11:15 UTC
Re: PostgreSQL + database.yml - how do I tell it to ignore the fact that other sessions are open in the database?
Thanks for the reply Michael, that did help some. At least now I have a clue as to what the linchpin in this thing is: PostgreSQL templates. Totally new concept to me, but now I can Google it. Thanks again! On Jul 20, 5:07 am, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 20 July 2011 12:04, Phoenix Rising <polarisris...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Since recently switching to PostgreSQL from MySQL, I''ve frequently run > > into an annoyance that occurs to me I *may* need to adjust in > > database.yml. Obviously I''d Google for this, but I have no idea what > > to call this issue. > > Does this help:http://stackoverflow.com/questions/4977171/rails-test-database-postgr...-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Simon Riggs
2011-Jul-20 12:10 UTC
Re: PostgreSQL + database.yml - how do I tell it to ignore the fact that other sessions are open in the database?
On Wed, Jul 20, 2011 at 12:04 PM, Phoenix Rising <polarisrising-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Since recently switching to PostgreSQL from MySQL, I''ve frequently run > into an annoyance that occurs to me I *may* need to adjust in > database.yml. Obviously I''d Google for this, but I have no idea what > to call this issue. > > When I run my tests, e.g. "rake test:units", I get a notice that > "There are N other session(s) using the database." This is awesome > for production environments, but in development, it''s just plain > annoying. > > I''m not sure if this is a warning from the rake task doing the DB > drop, or from PostgreSQL itself. How can I get it to just not care in > development mode, like MySQL does?The error message you''re getting is because when PostgreSQL creates a new database it uses an existing database as a template. If somebody is connected to the existing database being used as a template then the create fails. There isn''t really any reason to be connecting to the "template1" database, so the way to make this work correctly is to avoid anybody connecting to that. Is the test suite connecting twice and then blowing itself up, or is there another user there? Switching to using template0 is not the correct solution. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.