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