Commit 50c1374
committed
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 200ba16 in favor of a more
direct test for the real problem.
Back-patch to 9.2 where the bug was introduced (by commit
7741dd6).1 parent 200ba16 commit 50c1374
File tree
6 files changed
+52
-34
lines changed- src
- backend/optimizer
- path
- plan
- test/regress
- expected
- sql
6 files changed
+52
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | | - | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1163 | 1165 | | |
1164 | 1166 | | |
1165 | 1167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
| 681 | + | |
| 682 | + | |
682 | 683 | | |
683 | 684 | | |
684 | 685 | | |
685 | 686 | | |
686 | | - | |
687 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
688 | 690 | | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
693 | 694 | | |
694 | 695 | | |
695 | 696 | | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
702 | 721 | | |
703 | 722 | | |
704 | | - | |
| 723 | + | |
705 | 724 | | |
706 | 725 | | |
707 | 726 | | |
708 | 727 | | |
709 | 728 | | |
710 | 729 | | |
711 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
712 | 738 | | |
713 | 739 | | |
714 | 740 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| |||
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| 229 | + | |
| 230 | + | |
227 | 231 | | |
228 | 232 | | |
229 | 233 | | |
| |||
1386 | 1390 | | |
1387 | 1391 | | |
1388 | 1392 | | |
| 1393 | + | |
1389 | 1394 | | |
1390 | 1395 | | |
1391 | 1396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| 163 | + | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
| |||
828 | 831 | | |
829 | 832 | | |
830 | 833 | | |
| 834 | + | |
831 | 835 | | |
832 | 836 | | |
833 | 837 | | |
| |||
0 commit comments