Kirk Parker <khp(at)equatoria(dot)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