Re: Foreign key referential actions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Foreign key referential actions
Date
Msg-id 4098.1005693991@sss.pgh.pa.us
Whole thread Raw
In response to Foreign key referential actions  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: Foreign key referential actions
List pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Right now, referential actions get deferred along with normal
> checks and run against the state of the database at that time.
> I think this violates SQL92 11.8 General Rules 4-6 and have some
> reasoning and proposed ideas towards making it more complient
> although I don't actually have an implementation in mind for
> the most correct version. :(

I'm not convinced.  11.8 GR 1 refers to clause 10.6 as specifying
when the referential constraint is to be checked.  10.6 says that
immediate-mode constraints are checked "on completion" of each SQL
statement.  (It doesn't say anything about deferred-mode constraints,
but I suppose those are checked at end of transaction.)

I think the intended meaning is that the actions caused by the
constraint are taken when the constraint is checked, which is
either end of statement or end of transaction.  Which is what
we're doing now.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] More FK patches
Next
From: Stephan Szabo
Date:
Subject: Re: Foreign key referential actions