pascal+postgres@ensieve.org writes:
> Why is that forbidden? Isn't the purpose of a RETURNING clause to return values like a SELECT statement would, and
shouldn'tit therefore be allowed to occur in the same places?
An INSERT/UPDATE/DELETE RETURNING can be used as a CTE, not as a
sub-select. Sub-selects aren't sufficiently independent of the outer
query, eg they might be evaluated more than once, or not at all, or
only partially.
regards, tom lane