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 :slight_smile:

Does this help:

http://stackoverflow.com/questions/4977171/rails-test-database-postgresql-errors-os-x

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!

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.