BUG #5754: CTE optimization fails to account for side effects

Поиск
Список
Период
Сортировка
От David Fetter
Тема BUG #5754: CTE optimization fails to account for side effects
Дата
Msg-id 201011152211.oAFMBOmm031718@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5754: CTE optimization fails to account for side effects  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5754
Logged by:          David Fetter
Email address:      david@fetter.org
PostgreSQL version: 8.4+
Operating system:   All
Description:        CTE optimization fails to account for side effects
Details:

Here's how to reproduce:

BEGIN;
CREATE SEQUENCE my_seq;
WITH t AS (SELECT nextval('my_seq')) VALUES(1);
SELECT currval('my_seq');

ERROR:  currval of sequence "my_seq" is not yet defined in this session

What's happened is that the optimization didn't account for the idea that a
SELECT might have a side effect, and if we're going with the "CTEs execute
exactly once and (equivalent to) fully," this is a bug.

CTEs should not optimize away (parts of) SELECTs that have side effects.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Bug in concurrency control in temporary GiST indexes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5754: CTE optimization fails to account for side effects