Thread: lock a database from new connections, without modifying pg_hba.conf

lock a database from new connections, without modifying pg_hba.conf

From
"Marc G. Fournier"
Date:
Is that possible?  I've checked the docs for 8.1, and am not finding
anything, nor anything in contrib ...

the best I've been able to think of so far is to modify pg_hba.conf to not
allow new connections for the duration of the operations I need to perform
(drop and create a database) ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664

"Marc G. Fournier" <scrappy@postgresql.org> writes:
> Is that possible?  I've checked the docs for 8.1, and am not finding
> anything, nor anything in contrib ...

> the best I've been able to think of so far is to modify pg_hba.conf to not
> allow new connections for the duration of the operations I need to perform
> (drop and create a database) ...

Not sure I understand what you need.  DROP DATABASE already locks out
new connections.

            regards, tom lane

Re: lock a database from new connections, without modifying

From
"Ben K."
Date:
> Is that possible?  I've checked the docs for 8.1, and am not finding anything,
> nor anything in contrib ...
> the best I've been able to think of so far is to modify pg_hba.conf to not
> allow new connections for the duration of the operations I need to perform
> (drop and create a database) ...

Just in case ...

update pg_catalog.pg_database set datallowconn = false where datname =
'...';

http://archives.postgresql.org/pgsql-docs/2004-11/msg00015.php
http://www.postgresql.org/docs/8.1/interactive/manage-ag-templatedbs.html


My twopence.

Ben K.
Developer
http://benix.tamu.edu

Can hba be manipulated in such a way to make Postgres "read only" to obtain a complete and full backup please, and if so, how?

On 5/19/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Marc G. Fournier" <scrappy@postgresql.org> writes:
> Is that possible?  I've checked the docs for 8.1, and am not finding
> anything, nor anything in contrib ...

> the best I've been able to think of so far is to modify pg_hba.conf to not
> allow new connections for the duration of the operations I need to perform
> (drop and create a database) ...

Not sure I understand what you need.  DROP DATABASE already locks out
new connections.

                       regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

Re: lock a database from new connections, without modifying pg_hba.conf

From
"Joshua D. Drake"
Date:
On Monday 10 July 2006 15:58, adey wrote:
> Can hba be manipulated in such a way to make Postgres "read only" to obtain
> a complete and full backup please, and if so, how?

PostgreSQL allows "complete and full backups" while in production. E.g; we
support hot backups :). You do not have to stop working just to run backups
(unlike another unnamed database).

Sincerely,

Joshua D. Drake



>
> On 5/19/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > "Marc G. Fournier" <scrappy@postgresql.org> writes:
> > > Is that possible?  I've checked the docs for 8.1, and am not finding
> > > anything, nor anything in contrib ...
> > >
> > > the best I've been able to think of so far is to modify pg_hba.conf to
> >
> > not
> >
> > > allow new connections for the duration of the operations I need to
> >
> > perform
> >
> > > (drop and create a database) ...
> >
> > Not sure I understand what you need.  DROP DATABASE already locks out
> > new connections.
> >
> >                        regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> >       subscribe-nomail command to majordomo@postgresql.org so that your
> >       message can get through to the mailing list cleanly

--
   === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
   Providing the most comprehensive  PostgreSQL solutions since 1997
             http://www.commandprompt.com/