Re: [BUGS] BUG #14870: wrong query results when using WITH with UPDATE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #14870: wrong query results when using WITH with UPDATE
Дата
Msg-id 2125.1519074339@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14870: wrong query results when using WITH with UPDATE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
I wrote:
> The answer turns out to be that if EPQ is fired, then we instantiate a new
> copy of the whole outer plan tree (though apparently not the InitPlan),
> resulting in an additional ExecInitCteScan call that allocates an
> additional read pointer on the same tuplestore, and it's that one being
> the active one that causes the observed misbehavior.

Oh, on closer inspection I had that backwards: the EPQ plan tree would
normally contain only the child node(s) of the ModifyTable node, but
EvalPlanQualStart also duplicates all InitPlan or SubPlan node trees,
because it can't tell which of them might get used within the EPQ subtree.
So we get one extra ExecInitCteScan call, even though no actual access
to the tuplestore could happen.

So we can now characterize the problem case as "CTE is read within an
InitPlan or SubPlan, and the query as a whole encounters an EPQ recheck".

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14870: wrong query results when using WITH with UPDATE
Следующее
От: Sudalai
Дата:
Сообщение: Re: Segmentation Fault in logical decoding get/peek API