From: | Yeb Havinga <yebhavinga(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> |
Cc: | David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: wCTE behaviour |
Date: | 2010-11-12 08:14:57 |
Message-ID: | 4CDCF781.6050307@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2010-11-11 17:50, Marko Tiikkaja wrote:
> Just to be clear, the main point is whether they see the data
> modifications or not. The simplest case to point out this behaviour is:
>
> WITH t AS (DELETE FROM foo)
> SELECT * FROM foo;
>
> And the big question is: what state of "foo" should the SELECT
> statement see?
Since t is not referenced in the query, foo should not be deleted at
all, like
WITH t AS (SELECT nextval('seq'))
SELECT * FROM foo
does not update the sequence.
But if t is referenced..
WITH t AS (DELETE FROM foo RETURNING *)
SELECT * FROM foo NATURAL JOIN t;
Since the extension of t can only be known by deleting foo, it makes
sense that this query cannot return rows. "Select the rows from foo that
I just deleted."
regards,
Yeb Havinga
From | Date | Subject | |
---|---|---|---|
Next Message | Yeb Havinga | 2010-11-12 08:52:13 | Re: Restructuring plancache.c API |
Previous Message | Gabriele Bartolini | 2010-11-12 07:45:07 | Re: locales and encodings Oh MY! |