Re: top-level DML under CTEs

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: top-level DML under CTEs
Date: 2010-09-13 18:43:18
Message-ID: AANLkTi=46iAPEifschuCrcUwm6FqSxkOJ-5w36m4CXdP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

On Mon, Sep 13, 2010 at 9:20 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Sep 13, 2010 at 9:15 AM, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> wrote:
>> The patch attached is based on the one rejected at the last CF for 9.0
>> last year.
>>
>> http://archives.postgresql.org/message-id/16303.1266023203@sss.pgh.pa.us
>>
>> This patch implements the feature that allows top-level DMLs under CTE
>> WITH clause. For example:
>>
>> WITH t AS (SELECT * FROM x)
>> UPDATE y SET val = t.val FROM t
>> WHERE y.key = t.key;
>>
>> This feature is part of writeable CTEs proposed by David Fetter originally.
>
> Thanks for pursuing this.  I think this will be a useful feature if we
> can get it committed, and plus David Fetter will be very, very happy.
> :-)

Just to be clear, the attached patch is missing the part of the wCTE
that allows queries of the form:
WITH foo AS (DELETE * FROM bar RETURNING *) <any query using foo>

IOW, your CTE query has to be a select. This is still highly useful
however. The patch itself looks very clean after a quick glance
(which is all I can offer ATM unfortunately).

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-09-13 19:14:49 Re: top-level DML under CTEs
Previous Message Tom Lane 2010-09-13 18:41:13 Re: Policy decisions and cosmetic issues remaining for the git conversion

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Robert Haas 2010-09-13 19:14:49 Re: top-level DML under CTEs
Previous Message Robert Haas 2010-09-13 13:20:19 Re: top-level DML under CTEs