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@nooper.com - Testing - http://nooper.co.jp/labs