Re: Writeable CTEs and side effects - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Writeable CTEs and side effects
Date
Msg-id 6537.1255029119@sss.pgh.pa.us
Whole thread Raw
In response to Re: Writeable CTEs and side effects  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Writeable CTEs and side effects
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> On Thu, 2009-10-08 at 12:57 -0400, Tom Lane wrote:
>> I also agree with bumping the CID in between.

> Do you mean bump the CID in between each DML statement, or between the
> last DML statement and the main query? If the former, how should we
> choose the order of execution?

I would suggest bumping the CID after each WITH RETURNING query is
complete.

The order-of-execution issue is a good point, but is there a reason
not to do them in the order the WITH clauses appear syntactically?

One potentially interesting issue is if RETURNING withs are mixed
with plain-SELECT withs.  If we stick with the current plan then
the plain-SELECTs would execute after the RETURNINGs, which would
make things apparently not syntax-order.  An easy answer to that
one is to insist that all the RETURNING queries appear first.

> I'm not sure if this is a problem, but it seems like we're essentially
> allowing a complex transaction to take place in one statement. Is that
> what we want?

Yeah, I think that's more or less the point ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: Using results from INSERT ... RETURNING
Next
From: Dimitri Fontaine
Date:
Subject: Re: Concurrency testing