Re: drop/add fk in transaction

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: drop/add fk in transaction
Date: 2003-08-14 02:23:58
Message-ID: 20030813192119.Y66616-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

On 14 Aug 2003, Nabil Sayegh wrote:

> Am Don, 2003-08-14 um 02.36 schrieb Stephan Szabo:
> > On 14 Aug 2003, Nabil Sayegh wrote:
> >
> > > I want to convert a database from 7.2 RI to 7.3 RI
> > > I need to drop 165 RI_ConstraintTrigger and
> > > add 55 7.3-style foreign keys.
> > >
> > > Is it possible to do all that in a transaction ?
> >
> > It should be fine I think barring that you probably
> > don't want other transactions going on that might
> > touch those tables concurrently because you're going
> > to be grabbing exclusive locks on a bunch of tables
> > and you want to make sure you don't deadlock with
> > some other transaction.
>
> The action should take only 2 seconds or so.

Do you have data in the tables? Because if you're planning
to use ALTER TABLE ADD CONSTRAINT to add the new version
constraints it's going to check that the constraint is
satisified (and that can be not so fast).

> I think it would be ok for that case to lock everything :) while this
> transaction is running.
>
> Do you have a commandline by hand ?

I'd look at contrib/adddepend which I think does some portion
of this and will probably give you some ideas.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2003-08-14 03:38:43 Re: Vacuuming unicode database
Previous Message Bruce Momjian 2003-08-14 00:52:54 Re: Transaction question

Browse pgsql-novice by date

  From Date Subject
Next Message Cath Lawrence 2003-08-14 04:59:53 Large object - what's happening?
Previous Message Nabil Sayegh 2003-08-14 00:36:11 Re: drop/add fk in transaction