Re: stopping access to a database

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: <gearond(at)cvc(dot)net>, "Neil Conway" <neilc(at)samurai(dot)com>
Cc: "postgres list" <pgsql-general(at)postgresql(dot)org>
Subject: Re: stopping access to a database
Date: 2003-01-29 03:01:46
Message-ID: GNELIHDDFBOCMGBFGEFOCEDPCFAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 will just see the old data right up until you commit.

Chris

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)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(at)samurai(dot)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(at)samurai(dot)com> || PGP Key ID: DB3C29FC
> >
> >
> >
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-01-29 03:18:34 Re: is_numeric() or extract_numeric() functions?
Previous Message Zachary Beane 2003-01-29 03:01:35 Re: is_numeric() or extract_numeric() functions?