Re: almost there on a design - Mailing list pgsql-general

From Dennis Gearon
Subject Re: almost there on a design
Date
Msg-id FBBNJGFMKHGBGBRN174LKI08YW3.3e63f447@cal-lab
Whole thread Raw
In response to Re: almost there on a design  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: almost there on a design  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
so make a column in EACH table,
that references the primary key of the other table,
then set one of the constraints deferrable,
write the table with that one first - inside of a transaction

Is that it?


3/3/2003 4:18:43 PM, Stephan Szabo <sszabo@megazone23.bigpanda.com> wrote:

>
>On Mon, 3 Mar 2003, Dennis Gearon wrote:
>
>> Is it possible to do 'cross constraints' between two tables using a transaction and:
>>
>>     SET�CONSTRAINTS�ALL�DEFERRED;
>>
>> Or making both tables INITIALLY DEFERRED?
>
>You make constraints INITIALLY DEFERRED, but yes in general, although
>technically you only need to make one of the constraints deferred unless
>you don't want to constraint the order that the rows are made.
>
>PostgreSQL doesn't support deferred check constraints, and in general the
>deferred trigger stuff isn't really meant for end-user use (it's really
>there for supporting foreign keys), so you'll probably want to make the
>foreign key from usremailaddrs->usrs be initially deferred and insert the
>usremailaddrs row first.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>




pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: Hosting a data file on a SAN
Next
From: "Munteanu Gabriel"
Date:
Subject: Re: wal-debug