pgsql: Better fix for permissions tests in excluded subqueries.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Better fix for permissions tests in excluded subqueries.
Дата
Msg-id E1UaBTC-00055e-Bv@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Better fix for permissions tests in excluded subqueries.

This reverts the code changes in 50c137487c96e629e0e5372bb3d1b5f1a2f71a88,
which turned out to induce crashes and not completely fix the problem
anyway.  That commit only considered single subqueries that were excluded
by constraint-exclusion logic, but actually the problem also exists for
subqueries that are appendrel members (ie part of a UNION ALL list).  In
such cases we can't add a dummy subpath to the appendrel's AppendPath list
without defeating the logic that recognizes when an appendrel is completely
excluded.  Instead, fix the problem by having setrefs.c scan the rangetable
an extra time looking for subqueries that didn't get into the plan tree.
(This approach depends on the 9.2 change that made set_subquery_pathlist
generate dummy paths for excluded single subqueries, so that the exclusion
behavior is the same for single subqueries and appendrel members.)

Note: it turns out that the appendrel form of the missed-permissions-checks
bug exists as far back as 8.4.  However, since the practical effect of that
bug seems pretty minimal, consensus is to not attempt to fix it in the back
branches, at least not yet.  Possibly we could back-port this patch once
it's gotten a reasonable amount of testing in HEAD.  For the moment I'm
just going to revert the previous patch in 9.2.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a7b965382cf0cb30aeacb112572718045e6d4be7

Modified Files
--------------
src/backend/optimizer/path/allpaths.c    |    4 +-
src/backend/optimizer/plan/createplan.c  |   33 +---
src/backend/optimizer/plan/setrefs.c     |  251 +++++++++++++++++++++++-------
src/test/regress/expected/privileges.out |   15 ++
src/test/regress/sql/privileges.sql      |   15 ++
5 files changed, 233 insertions(+), 85 deletions(-)


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: The data structure used in unaccent is a trie, not suffix tree.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Revert "Fix permission tests for views/tables proven empty by co