Re: stopping access to a database - Mailing list pgsql-general

From Christopher Kings-Lynne
Subject Re: stopping access to a database
Date
Msg-id GNELIHDDFBOCMGBFGEFOCEDPCFAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: stopping access to a database  (Dennis Gearon <gearond@cvc.net>)
List pgsql-general
Why do you even need to lock access to the tables???

Just fire up a transaction, delete everything from the tables and import the new data and then commit.  Other users
willjust see the old data right up until you commit. 

Chris

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Dennis Gearon
> Sent: Wednesday, 29 January 2003 8:11 AM
> To: Neil Conway
> Cc: postgres list
> Subject: Re: [GENERAL] stopping access to a database
>
>
> Ooooooooohhhhhhhhhhh,
>     That would work! I didn't know I could get an exclusive
> lock on tables in a transaction,
> I thought it was just for rows, (the opposite of MySQL). This is
> good, and 'back to the
> manual' for more reading!
>
> 1/28/2003 12:22:50 PM, Neil Conway <neilc@samurai.com> wrote:
>
> >On Tue, 2003-01-28 at 11:50, Dennis Gearon wrote:
> >> I would like to stop accesses to database 2, delete all
> records in the 2-4 tables, and
> reimport
> >> new records. How would I do this as a user on the system, not
> as an admin?
> >
> >How about starting a transaction, acquiring an exclusive lock on all the
> >tables using LOCK TABLE, deleting & updating the data, and then
> >committing the transaction?
> >
> >Cheers,
> >
> >Neil
> >--
> >Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
> >
> >
> >
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.3 LOCK TABLE problem
Next
From: Tom Lane
Date:
Subject: Re: is_numeric() or extract_numeric() functions?