Re: Writeable CTEs and side effects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Writeable CTEs and side effects
Date: 2009-10-08 19:11:59
Message-ID: 6537.1255029119@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2009-10-08 19:26:51 Re: Concurrency testing
Previous Message Marko Tiikkaja 2009-10-08 18:59:04 Re: Using results from INSERT ... RETURNING