pgsql: Fix planning of SELECT FOR UPDATE on child table with partial in

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix planning of SELECT FOR UPDATE on child table with partial in
Дата
Msg-id E1XzFZg-0008AD-0e@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix planning of SELECT FOR UPDATE on child table with partial index.

Ordinarily we can omit checking of a WHERE condition that matches a partial
index's condition, when we are using an indexscan on that partial index.
However, in SELECT FOR UPDATE we must include the "redundant" filter
condition in the plan so that it gets checked properly in an EvalPlanQual
recheck.  The planner got this mostly right, but improperly omitted the
filter condition if the index in question was on an inheritance child
table.  In READ COMMITTED mode, this could result in incorrectly returning
just-updated rows that no longer satisfy the filter condition.

The cause of the error is using get_parse_rowmark() when get_plan_rowmark()
is what should be used during planning.  In 9.3 and up, also fix the same
mistake in contrib/postgres_fdw.  It's currently harmless there (for lack
of inheritance support) but wrong is wrong, and the incorrect code might
get copied to someplace where it's more significant.

Report and fix by Kyotaro Horiguchi.  Back-patch to all supported branches.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2ae8a01ca1af074c166e3f882869dfe307b91b2c

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c     |   19 +++++++++++--------
src/backend/optimizer/plan/createplan.c |    3 ++-
2 files changed, 13 insertions(+), 9 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix planning of SELECT FOR UPDATE on child table with partial in
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix planning of SELECT FOR UPDATE on child table with partial in