Re: Behavior of ON DELETE CASCADE in CTEs - Mailing list pgsql-docs

From Tom Lane
Subject Re: Behavior of ON DELETE CASCADE in CTEs
Date
Msg-id 1729420.1725499661@sss.pgh.pa.us
Whole thread Raw
In response to Behavior of ON DELETE CASCADE in CTEs  (Kirk Parker <khp@equatoria.us>)
List pgsql-docs
Kirk Parker <khp@equatoria.us> writes:
> It appears that in With-queries (CTE) the ON CASCADE DELETE deletions
> happen at the very end of the entire statement. I have two questions about
> this:

> (1) Is this a correct observation?
> (2) Is this intentional behavior, or only an accident of the implementation?

I believe it's required by SQL spec.  Or more accurately, the spec
says that constraint-triggered actions happen either at the end of the
statement or the end of the transaction, depending on whether you set
them as "deferred".

            regards, tom lane



pgsql-docs by date:

Previous
From: Kirk Parker
Date:
Subject: Behavior of ON DELETE CASCADE in CTEs
Next
From: "David G. Johnston"
Date:
Subject: Re: Behavior of ON DELETE CASCADE in CTEs