Commit d21fca0
committed
Fix misbehavior of DROP OWNED BY with duplicate polroles entries.
Ordinarily, a pg_policy.polroles array wouldn't list the same role
more than once; but CREATE POLICY does not prevent that. If we
perform DROP OWNED BY on a role that is listed more than once,
RemoveRoleFromObjectPolicy either suffered an assertion failure
or encountered a tuple-updated-by-self error. Rewrite it to cope
correctly with duplicate entries, and add a CommandCounterIncrement
call to prevent the other problem.
Per discussion, there's other cleanup that ought to happen here,
but this seems like the minimum essential fix.
Per bug #17062 from Alexander Lakhin. It's been broken all along,
so back-patch to all supported branches.
Discussion: https://postgr.es/m/17062-11f471ae3199ca23@postgresql.org1 parent 84bee96 commit d21fca0
File tree
3 files changed
+46
-23
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+46
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
428 | | - | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | 484 | | |
490 | | - | |
491 | | - | |
492 | | - | |
| 485 | + | |
493 | 486 | | |
494 | 487 | | |
495 | 488 | | |
496 | 489 | | |
497 | 490 | | |
498 | 491 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
| 492 | + | |
505 | 493 | | |
506 | 494 | | |
507 | 495 | | |
508 | 496 | | |
| 497 | + | |
509 | 498 | | |
510 | 499 | | |
511 | 500 | | |
| |||
582 | 571 | | |
583 | 572 | | |
584 | 573 | | |
585 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
586 | 579 | | |
587 | | - | |
588 | | - | |
| 580 | + | |
| 581 | + | |
589 | 582 | | |
590 | 583 | | |
| 584 | + | |
| 585 | + | |
591 | 586 | | |
592 | | - | |
593 | | - | |
594 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
595 | 590 | | |
596 | 591 | | |
597 | 592 | | |
| |||
646 | 641 | | |
647 | 642 | | |
648 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
649 | 647 | | |
650 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
657 | 661 | | |
658 | 662 | | |
659 | 663 | | |
660 | | - | |
| 664 | + | |
661 | 665 | | |
662 | 666 | | |
663 | 667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3886 | 3886 | | |
3887 | 3887 | | |
3888 | 3888 | | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
3889 | 3898 | | |
3890 | 3899 | | |
3891 | 3900 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1757 | 1757 | | |
1758 | 1758 | | |
1759 | 1759 | | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1760 | 1770 | | |
1761 | 1771 | | |
1762 | 1772 | | |
| |||
0 commit comments