forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaa5d3c0
committed
RLS: Fix ALL vs. SELECT+UPDATE policy usage
When we add the SELECT-privilege based policies to the RLS with checkoptions (such as for an UPDATE statement, or when we have INSERT ...RETURNING), we need to be sure and use the 'USING' case if the policy isactually an 'ALL' policy (which could have both a USING clause and anindependent WITH CHECK clause).This could result in policies acting differently when built using ALL(when the ALL had both USING and WITH CHECK clauses) and when buildingthe policies independently as SELECT and UPDATE policies.Fix this by adding an explicit boolean to add_with_check_options() toindicate when the USING policy should be used, even if the policy hasboth USING and WITH CHECK policies on it.Reported by: Rod TaylorBack-patch to 9.5 where RLS was introduced.1 parentb58c433 commitaa5d3c0
1 file changed
+15
-8
lines changedLines changed: 15 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
81 |
| - | |
| 81 | + | |
| 82 | + | |
82 | 83 |
| |
83 | 84 |
| |
84 | 85 |
| |
| |||
272 | 273 |
| |
273 | 274 |
| |
274 | 275 |
| |
275 |
| - | |
| 276 | + | |
| 277 | + | |
276 | 278 |
| |
277 | 279 |
| |
278 | 280 |
| |
| |||
295 | 297 |
| |
296 | 298 |
| |
297 | 299 |
| |
298 |
| - | |
| 300 | + | |
| 301 | + | |
299 | 302 |
| |
300 | 303 |
| |
301 | 304 |
| |
| |||
324 | 327 |
| |
325 | 328 |
| |
326 | 329 |
| |
327 |
| - | |
| 330 | + | |
| 331 | + | |
328 | 332 |
| |
329 | 333 |
| |
330 | 334 |
| |
| |||
346 | 350 |
| |
347 | 351 |
| |
348 | 352 |
| |
349 |
| - | |
| 353 | + | |
| 354 | + | |
350 | 355 |
| |
351 | 356 |
| |
352 | 357 |
| |
| |||
355 | 360 |
| |
356 | 361 |
| |
357 | 362 |
| |
358 |
| - | |
| 363 | + | |
| 364 | + | |
359 | 365 |
| |
360 | 366 |
| |
361 | 367 |
| |
| |||
659 | 665 |
| |
660 | 666 |
| |
661 | 667 |
| |
662 |
| - | |
| 668 | + | |
| 669 | + | |
663 | 670 |
| |
664 | 671 |
| |
665 | 672 |
| |
666 | 673 |
| |
667 | 674 |
| |
668 |
| - | |
| 675 | + | |
669 | 676 |
| |
670 | 677 |
| |
671 | 678 |
| |
|
0 commit comments
Comments
(0)