Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> writes:
> While working on writeable CTEs, I noticed I have to special-case the
> output of a Query node frequently because in INSERT/UPDATE/DELETE query
> targetList is the target list which is used for modifying the result
> relation and returningList is the output of that Query. However, this
> is different from SELECT where targetList actually is the output of that
> Query node. Attached is a patch which avoids this special-casing by
> making Query's targetList always be the output target list. The target
> list for the result relation is stored separately. The patch needs a
> bit more work but I'll be glad to do it if people think this is useful.
This doesn't really seem like a good idea from here. You're changing
a decision that has something like twenty years' standing in the code,
for no real gain. AFAICS this is just going to move the special cases
from point A to point B.
regards, tom lane