"David Fetter" <[EMAIL PROTECTED]> writes: > On Tue, May 29, 2007 at 09:41:38AM -0400, Tom Lane wrote: >> "Jan Szumiec" <[EMAIL PROTECTED]> writes: >> > UPDATE items SET (type, post_id) = (INSERT INTO efforts (effort) VALUES >> > (667) RETURNING 'Item', id) WHERE id = 1937 >> >> Sorry, RETURNING is only supported at the top level of a query. > > What would be involved with making this possible? What we have at the > moment is a pretty clear POLA violation because unlike the rest of the > row-returning objects (tables, views, SRFs and VALUES() clauses), only > RETURNING can't be used in a subquery.
It has the same problem that SELECT triggers have. How many rows should you expect that subquery to insert, update, or delete if it's used in a join clause? Or in the where clause of another insert/update/delete statement? -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster