Re: wCTE behaviour
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
Cc: David Fetter <david@fetter.org>, Peter Eisentraut <peter_e@gmx.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>, Yeb Havinga <yebhavinga@gmail.com>, Hitoshi Harada <umi.tanuki@gmail.com>
Date: 2011-02-24T23:36:03Z
Lists: pgsql-hackers
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> writes: > I fixed an issue with the portal logic, and now we use > PORTAL_ONE_RETURNING for wCTE queries, even if the main query is not a > DML or does not have RETURNING. This also means that we materialize the > results of the main query sometimes unnecessarily, but that doesn't look > like an easy thing to fix. PORTAL_ONE_RETURNING as a name is also a bit > misleading now, so maybe that needs changing.. Why is it necessary to hack the portal logic at all? The patch seems to work for me without that. (I've fixed quite a few bugs though, so maybe what this is really doing is masking a problem elsewhere.) Also, why are we forbidding wCTEs in cursors? Given the current definitions, that case seems to work fine too: the wCTEs will be executed as soon as you fetch something from the cursor. Are you just worried about not allowing a case that might be hard to support later? regards, tom lane