Re: Update Returning as subquery - Mailing list pgsql-sql

From Tom Lane
Subject Re: Update Returning as subquery
Date
Msg-id 16830.1407691068@sss.pgh.pa.us
Whole thread Raw
In response to Update Returning as subquery  (pascal+postgres@ensieve.org)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Marcin Krawczyk
Date:
Subject: Re: function call
Next
From: Andreas Joseph Krogh
Date:
Subject: How to optimize WHERE column_a IS NOT NULL OR column_b = 'value'