"with recursive" ignores side effects?

From: Fabien <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: "with recursive" ignores side effects?
Date: 2013-08-06 18:51:01
Message-ID: alpine.DEB.2.02.1308062030390.29999@localhost6.localdomain6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


I have an unexpected issue with a side effects on a table which is ignored
by a recursive query. I've tried to simplify the issue to a simple
example, see the attached sql script.

Version 1 results in:

it / fid / stuff / foo full contents
0 | 0 | | {1:one,2:two}
1 | 1 | one | {1:one,2:*}
2 | 2 | two | {1:*,2:*}

The key issue for me is that table Foo is updated (as shown by the last
column), but although 'two' was updated to '*' by iteration 1, the last
iteration still sees the initial 'two' which does not exist anymore.

Version 2 illustrates more or less the behavior I would have expected.
I've read again Section 7.8 about WITH queries, but I have not seen
anything that would disprove my expectation.

Am I wrong somewhere? Or is this a subtle bug?

--
Fabien.

Attachment Content-Type Size
test.sql application/x-sql 1.6 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2013-08-06 19:21:24 Re: "with recursive" ignores side effects?
Previous Message Tom Lane 2013-08-06 16:27:19 Re: BUG #8367: wrong example in 8.17.10