forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite89bd02
committed
Perform RLS WITH CHECK before constraints, etc
The RLS capability is built on top of the WITH CHECK OPTIONsystem which was added for auto-updatable views, however, unlikeWCOs on views (which are mandated by the SQL spec to not fire untilafter all other constraints and checks are done), it makes much moresense for RLS checks to happen earlier than constraint and uniquenesschecks.This patch reworks the structure which holds the WCOs a bit to beexplicitly either VIEW or RLS checks and the RLS-related checks aredone prior to the constraint and uniqueness checks. This also allowsbetter error reporting as we are now reporting when a violation is dueto a WITH CHECK OPTION and when it's due to an RLS policy violation,which was independently noted by Craig Ringer as being confusing.The documentation is also updated to include a paragraph about when RLSWITH CHECK handling is performed, as there have been a number ofquestions regarding that and the documentation was previously silent onthe matter.Author: Dean Rasheed, with some kabitzing and comment changes by me.1 parentc8aa893 commite89bd02
File tree
15 files changed
+175
-56
lines changed- doc/src/sgml/ref
- src
- backend
- executor
- nodes
- rewrite
- include
- executor
- nodes
- test
- modules/test_rls_hooks/expected
- regress
- expected
- sql
15 files changed
+175
-56
lines changedLines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
63 | 71 |
| |
64 | 72 |
| |
65 | 73 |
| |
|
Lines changed: 50 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1673 | 1673 |
| |
1674 | 1674 |
| |
1675 | 1675 |
| |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1676 | 1682 |
| |
1677 | 1683 |
| |
1678 |
| - | |
| 1684 | + | |
1679 | 1685 |
| |
1680 | 1686 |
| |
1681 | 1687 |
| |
| |||
1700 | 1706 |
| |
1701 | 1707 |
| |
1702 | 1708 |
| |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
1703 | 1716 |
| |
1704 | 1717 |
| |
1705 | 1718 |
| |
| |||
1714 | 1727 |
| |
1715 | 1728 |
| |
1716 | 1729 |
| |
1717 |
| - | |
1718 |
| - | |
1719 |
| - | |
1720 |
| - | |
1721 |
| - | |
1722 |
| - | |
1723 |
| - | |
1724 |
| - | |
1725 |
| - | |
1726 |
| - | |
1727 |
| - | |
1728 |
| - | |
1729 |
| - | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
1730 | 1766 |
| |
1731 | 1767 |
| |
1732 | 1768 |
| |
|
Lines changed: 49 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
255 | 265 |
| |
256 | 266 |
| |
257 | 267 |
| |
| |||
287 | 297 |
| |
288 | 298 |
| |
289 | 299 |
| |
290 |
| - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
291 | 313 |
| |
292 |
| - | |
| 314 | + | |
293 | 315 |
| |
294 | 316 |
| |
295 | 317 |
| |
| |||
653 | 675 |
| |
654 | 676 |
| |
655 | 677 |
| |
656 |
| - | |
| 678 | + | |
657 | 679 |
| |
658 | 680 |
| |
659 |
| - | |
660 |
| - | |
661 |
| - | |
662 |
| - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
663 | 688 |
| |
664 | 689 |
| |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
665 | 697 |
| |
666 | 698 |
| |
667 | 699 |
| |
| |||
780 | 812 |
| |
781 | 813 |
| |
782 | 814 |
| |
783 |
| - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
784 | 824 |
| |
785 |
| - | |
| 825 | + | |
786 | 826 |
| |
787 | 827 |
| |
788 | 828 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2064 | 2064 |
| |
2065 | 2065 |
| |
2066 | 2066 |
| |
2067 |
| - | |
| 2067 | + | |
| 2068 | + | |
2068 | 2069 |
| |
2069 | 2070 |
| |
2070 | 2071 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2363 | 2363 |
| |
2364 | 2364 |
| |
2365 | 2365 |
| |
2366 |
| - | |
| 2366 | + | |
| 2367 | + | |
2367 | 2368 |
| |
2368 | 2369 |
| |
2369 | 2370 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2332 | 2332 |
| |
2333 | 2333 |
| |
2334 | 2334 |
| |
2335 |
| - | |
| 2335 | + | |
| 2336 | + | |
2336 | 2337 |
| |
2337 | 2338 |
| |
2338 | 2339 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
269 |
| - | |
| 269 | + | |
| 270 | + | |
270 | 271 |
| |
271 | 272 |
| |
272 | 273 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2947 | 2947 |
| |
2948 | 2948 |
| |
2949 | 2949 |
| |
2950 |
| - | |
| 2950 | + | |
| 2951 | + | |
2951 | 2952 |
| |
2952 | 2953 |
| |
2953 | 2954 |
| |
|
Lines changed: 19 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
259 | 259 |
| |
260 | 260 |
| |
261 | 261 |
| |
262 |
| - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
263 | 265 |
| |
264 | 266 |
| |
265 | 267 |
| |
| |||
274 | 276 |
| |
275 | 277 |
| |
276 | 278 |
| |
277 |
| - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
278 | 282 |
| |
279 | 283 |
| |
280 | 284 |
| |
| |||
285 | 289 |
| |
286 | 290 |
| |
287 | 291 |
| |
288 |
| - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
289 | 295 |
| |
290 | 296 |
| |
291 | 297 |
| |
| |||
297 | 303 |
| |
298 | 304 |
| |
299 | 305 |
| |
300 |
| - | |
301 |
| - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
302 | 311 |
| |
303 | 312 |
| |
304 | 313 |
| |
305 | 314 |
| |
306 |
| - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
307 | 318 |
| |
308 | 319 |
| |
309 | 320 |
| |
| |||
332 | 343 |
| |
333 | 344 |
| |
334 | 345 |
| |
335 |
| - | |
| 346 | + | |
| 347 | + | |
336 | 348 |
| |
337 | 349 |
| |
338 | 350 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
196 |
| - | |
| 196 | + | |
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
306 |
| - | |
| 306 | + | |
307 | 307 |
| |
308 | 308 |
| |
309 | 309 |
| |
|
Lines changed: 12 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
872 | 872 |
| |
873 | 873 |
| |
874 | 874 |
| |
875 |
| - | |
| 875 | + | |
| 876 | + | |
876 | 877 |
| |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
877 | 885 |
| |
878 | 886 |
| |
879 | 887 |
| |
880 |
| - | |
| 888 | + | |
| 889 | + | |
881 | 890 |
| |
882 |
| - | |
| 891 | + | |
883 | 892 |
| |
884 | 893 |
| |
885 | 894 |
| |
|
0 commit comments
Comments
(0)