Re: Resolving of reference/foreign keys

From: Thomas O'Dowd <tom(at)nooper(dot)com>
To: Fredrik Wendt <fredrik(dot)wendt(at)linux(dot)se>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Resolving of reference/foreign keys
Date: 2002-03-20 00:35:50
Message-ID: 20020320093550.C1200@beast.uwillsee.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, Mar 20, 2002 at 01:31:07AM +0100, Fredrik Wendt wrote:
> Thomas O'Dowd wrote:
>
> > [...]
> > I've set ON DELETE to NO ACTION which means that if you delete a row
> > from table a which is a FK in table b, the delete will fail unless you
> > also delete the row in table b. I believe this is what you're looking
> > for.
> >
> > You don't need to write any special code then to test or count
> > references etc. Postgresql does it all for you. Check out the
> > docs for more info.
>
> Just a quick one: This deletion, must it be done in (1) one statement,
> or can the delete operation be approved if (2) multiple delete
> statements are issued within a transaction?

The DEFERRABLE keyword says that the RI check should wait until the
end of a transaction before complaining. So the answer is both in
this case. Its all in the docs.

http://www.postgresql.org/idocs/index.php?sql-createtable.html

Tom.
--
Thomas O'Dowd. - Nooping - http://nooper.com
tom(at)nooper(dot)com - Testing - http://nooper.co.jp/labs

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas O'Dowd 2002-03-20 00:47:33 Re: "No results were returned by the query" exceptions
Previous Message Fredrik Wendt 2002-03-20 00:31:07 Re: Resolving of reference/foreign keys