On 2010-01-05 20:40 +0200, Tom Lane wrote:
> Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> writes:
>> => with t as (delete from foo returning *)
>> -> insert into bar
>> -> select * from t;
>> INSERT 0 2
>
>> It correctly reports 2 affected rows (one deleted and one inserted), but
>> is this the answer we want?
>
> No. The returned tag should consider only the top-level operation,
> not what happened inside any CTEs.
Attached is the latest version of the patch. This fixes all issues I'm
aware of. This one also allows forward-referencing and recursive CTEs
in the same CTE list with writeable CTEs, using the RECURSIVE keyword.
Regards,
Marko Tiikkaja