Re: Writeable CTEs

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Writeable CTEs
Date: 2010-01-12 18:55:54
Message-ID: 4B4CC5BA.4020901@cs.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2010-01-05 20:40 +0200, Tom Lane wrote:
> Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)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

Attachment Content-Type Size
writeable5.patch text/plain 67.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-01-12 18:58:25 Re: Hot Standy introduced problem with query cancel behavior
Previous Message Magnus Hagander 2010-01-12 18:54:27 Re: mailing list archiver chewing patches