Hitoshi Harada <umi.tanuki@gmail.com> writes:
> 2010/11/9 Tom Lane <tgl@sss.pgh.pa.us>:
>> My opinion is still the same as here:
>> http://archives.postgresql.org/pgsql-hackers/2010-02/msg00688.php
> Current consensus says:
> WITH x AS (SELECT count(*) FROM t), y AS (DELETE FROM t), z AS (SELECT
> count(*) FROM t) SELECT x.count, z.count FROM x, z;
> should return 0 for z.count but some number of original rows for
> x.count.
Consensus according to who? It's at least as consistent for all the
queries to start from the same snapshot, meaning that x and z would
produce the same results (independent of what y does).
It might be worth inspecting the SQL2011 draft to see if they provide
any guidance on what ought to happen here.
regards, tom lane