Problem Dropping a Database with users connected to it

From: Eric Dorland <eric(dot)dorland(at)mcgill(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem Dropping a Database with users connected to it
Date: 2005-01-14 16:16:16
Message-ID: 1105719377.7029.24.camel@garuda.wcg.mcgill.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)dorland(at)mcgill(dot)ca
WCG
514.398-5023 ext. 09562

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roman Neuhauser 2005-01-14 16:24:11 Re: pl/pgsql trigger: syntax error at or near "ELSEIF"
Previous Message Magnus Hagander 2005-01-14 16:11:43 Re: Problem running native windows Postgres 8 pg_dump etc on