Search Postgresql Archives

Re: How to defer ON DELETE CASCADE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arjen Nienhuis <a.g.nienhuis@xxxxxxxxx> writes:
> If I create a DEFERRED ON DELETE CASCADE constraint, it doesn't really work
> as I expected. I expected it to defer the deletion to the end of the
> transaction, but it dosn't.

Yeah, this is per SQL spec as far as we can tell.  Constraint checks can
be deferred till end of transaction, but "referential actions" are not
deferrable.  They always happen during the triggering statement.  For
instance SQL99 describes the result of a cascade deletion as being that
the referencing row is "marked for deletion" immediately, and then

        15) All rows that are marked for deletion are effectively deleted
            at the end of the SQL-statement, prior to the checking of any
            integrity constraints.

(see 11.8 <referential constraint definition> general rules)

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux