On 3/2/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > For example, should it be possible to write:
> > FOR x in DELETE FROM t1 WHERE ... RETURNING t1.x LOOP
>
> Seems like you'd want to get there eventually, if not in the first cut.
I'd like to get this into the first release of RETURNING for 8.2.
> I wonder if we should rejigger the representation of Query so that a
> FOO-RETURNING command actually *is* a SELECT in some sense, so that
> there's no need for special cases.
I want to get rid of all the special case code and move in this
direction, that way we can make better use of code that already exists
and is well-tested.
> I'm a bit fuzzy about how this would work exactly --- you still need to
> keep track of two targetlists it seems --- but it's worth thinking
> about. I've had a bee in my bonnet for literally years about the fact
> that INSERT/SELECT really needs two levels of targetlist, as does UNION.
> Maybe if we thought a little bit larger we could clean up all of that
> messiness at one stroke.
Have you had any ideas on how to best accomplish this?
--
Jonah H. Harris, Database Internals Architect
EnterpriseDB Corporation
732.331.1324