pgsql: Remove faulty support for MergeAppend plan with WHERE CURRENT OF

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Remove faulty support for MergeAppend plan with WHERE CURRENT OF
Дата
Msg-id E1l1vi4-0003MR-Pz@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove faulty support for MergeAppend plan with WHERE CURRENT OF.

Somebody extended search_plan_tree() to treat MergeAppend exactly
like Append, which is 100% wrong, because unlike Append we can't
assume that only one input node is actively returning tuples.
Hence a cursor using a MergeAppend across a UNION ALL or inheritance
tree could falsely match a WHERE CURRENT OF query at a row that
isn't actually the cursor's current output row, but coincidentally
has the same TID (in a different table) as the current output row.

Delete the faulty code; this means that such a case will now return
an error like 'cursor "foo" is not a simply updatable scan of table
"bar"', instead of silently misbehaving.  Users should not find that
surprising though, as the same cursor query could have failed that way
already depending on the chosen plan.  (It would fail like that if the
sort were done with an explicit Sort node instead of MergeAppend.)

Expand the clearly-inadequate commentary to be more explicit about
what this code is doing, in hopes of forestalling future mistakes.

It's been like this for awhile, so back-patch to all supported
branches.

Discussion: https://postgr.es/m/482865.1611075182@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6253159965d563dd0e416e064b760e381a60b8e8

Modified Files
--------------
src/backend/executor/execCurrent.c | 53 +++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 26 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: pageinspect: Change block number arguments to bigint
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix ALTER DEFAULT PRIVILEGES with duplicated objects