Problem Dropping a Database with users connected to it - Mailing list pgsql-general

From Eric Dorland
Subject Problem Dropping a Database with users connected to it
Date
Msg-id 1105719377.7029.24.camel@garuda.wcg.mcgill.ca
Whole thread Raw
Responses Re: Problem Dropping a Database with users connected to it  (Fernando Schapachnik <fernando@mecon.gov.ar>)
Re: Problem Dropping a Database with users connected to it  (Bruno Wolff III <bruno@wolff.to>)
Re: Problem Dropping a Database with users connected to it  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

I'm basically trying to do what the subject says, through various means
with no success. The basic situation is that every night we recreate our
development database with a complete copy of our live data. The problem
is some of the developers (well me especially) leave open connections to
the DB at night, so the database drop fails. Now that's ok, but I need
some sort of alternative... I thought of:

* Disconnecting all other users before dropping the db, but that doesn't
seem possible (I could start and stop the db, but that doesn't stop any
clients from just reconnecting right away).

* Some sort of idle time disconnection. Postgres doesn't seem to support
this.

* Just drop all the tables, etc. instead of dropping the db. There
doesn't seem to be a good way to do this except doing an explicit DROP
TABLE foo on all 200 tables. Is there a good recipe for this, an easy
way to get a listing of all the tables in a db?

Can anyone suggest an approach I missed or enlighten me on how to
accomplish one of the above. Thanks very much.

--
Eric Dorland
eric.dorland@mcgill.ca
WCG
514.398-5023 ext. 09562


pgsql-general by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Problem running native windows Postgres 8 pg_dump etc on
Next
From: Roman Neuhauser
Date:
Subject: Re: pl/pgsql trigger: syntax error at or near "ELSEIF"