On 2010-11-14 5:28 PM +0200, Hitoshi Harada wrote:
> 2010/11/14 Marko Tiikkaja<marko.tiikkaja@cs.helsinki.fi>:
>> .. and a wild patch appears.
>
> Could you update wiki on this feature if you think we've reached the consensus?
You're probably referring to
http://archives.postgresql.org/pgsql-hackers/2010-11/msg00660.php
which was unfortunately just me talking too soon. There still doesn't
appear to be a consensus on the difference (if any) between these queries:
WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 LIMIT 0; -- unreferenced CTE
WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t LIMIT 0; -- referenced, but not read
WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t LIMIT 1; -- referenced, but only partly read
WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t t1, t t2; -- referenced, read multiple times
In my opinion, all of these should have the same effect: DELETE all rows
from "foo". Any other option means we're going to have trouble
predicting how a query is going to behave.
As far as I know, we do have a consensus that the order of execution
should be an implementation detail, and that the statements should
always be executed in the exact same snapshot (i.e. no CID bump between).
> Also, wrapping up the discussion like pros& cons on the different
> execution models helps not only the advance discussions but also
> reviews of this patch.
Do you mean between the "execute in order, bump CID" and "execute in
whatever order but to completion" behaviours?
Regards,
Marko Tiikkaja