From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix permission tests for views/tables proven empty by constraint |
Date: | 2013-05-01 22:27:15 |
Message-ID: | E1UXfUZ-0000J8-0J@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix permission tests for views/tables proven empty by constraint exclusion.
A view defined as "select <something> where false" had the curious property
that the system wouldn't check whether users had the privileges necessary
to select from it. More generally, permissions checks could be skipped
for tables referenced in sub-selects or views that were proven empty by
constraint exclusion (although some quick testing suggests this seldom
happens in cases of practical interest). This happened because the planner
failed to include rangetable entries for such tables in the finished plan.
This was noticed in connection with erroneous handling of materialized
views, but actually the issue is quite unrelated to matviews. Therefore,
revert commit 200ba1667b3a8d7a9d559d2f05f83d209c9d8267 in favor of a more
direct test for the real problem.
Back-patch to 9.2 where the bug was introduced (by commit
7741dd6590073719688891898e85f0cb73453159).
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/50c137487c96e629e0e5372bb3d1b5f1a2f71a88
Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 4 ++-
src/backend/optimizer/plan/createplan.c | 54 ++++++++++++++++++++++--------
src/test/regress/expected/matview.out | 12 -------
src/test/regress/expected/privileges.out | 5 +++
src/test/regress/sql/matview.sql | 7 ----
src/test/regress/sql/privileges.sql | 4 ++
6 files changed, 52 insertions(+), 34 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2013-05-01 22:49:18 | pgsql: Use correct length to convert json unicode escapes. |
Previous Message | Tom Lane | 2013-05-01 16:20:25 | Re: [COMMITTERS] pgsql: Add regression test for bug fixed by recent refactoring. |