forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6566133
committed
Ensure that pg_auth_members.grantor is always valid.
Previously, "GRANT foo TO bar" or "GRANT foo TO bar GRANTED BY baz"would record the OID of the grantor in pg_auth_members.grantor, butthat role could later be dropped without modifying or removing thepg_auth_members record. That's not great, because we typically tryto avoid dangling references in catalog data.Now, a role grant depends on the grantor, and the grantor can't bedropped without removing the grant or changing the grantor. "DROPOWNED BY" will remove the grant, just as it does for other kinds ofprivileges. "REASSIGN OWNED BY" will not, again just like what we doin other cases involving privileges.pg_auth_members now has an OID column, because that is needed in orderfor dependencies to work. It also now has an index on the grantorcolumn, because otherwise dropping a role would require a sequentialscan of the entire table to see whether the role's OID is in use asa grantor. That probably wouldn't be too large a problem in practice,but it seems better to have an index just in case.A follow-on patch is planned with the goal of more thoroughlyrationalizing the behavior of role grants. This patch is just tryingto do enough to make sure that the data we store in the catalogs is atsome basic level valid.Patch by me, reviewed by Stephen FrostDiscussion:http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com1 parent2f17b57 commit6566133
File tree
16 files changed
+397
-68
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- include/catalog
- test/regress
- expected
- sql
16 files changed
+397
-68
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1669 | 1669 |
| |
1670 | 1670 |
| |
1671 | 1671 |
| |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1672 | 1681 |
| |
1673 | 1682 |
| |
1674 | 1683 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
| 265 | + | |
| 266 | + | |
265 | 267 |
| |
266 | 268 |
| |
267 | 269 |
| |
|
Lines changed: 11 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
| 176 | + | |
175 | 177 |
| |
176 | 178 |
| |
177 | 179 |
| |
| |||
1502 | 1504 |
| |
1503 | 1505 |
| |
1504 | 1506 |
| |
| 1507 | + | |
1505 | 1508 |
| |
1506 | 1509 |
| |
1507 | 1510 |
| |
| |||
1529 | 1532 |
| |
1530 | 1533 |
| |
1531 | 1534 |
| |
1532 |
| - | |
1533 |
| - | |
1534 |
| - | |
| 1535 | + | |
| 1536 | + | |
1535 | 1537 |
| |
1536 | 1538 |
| |
1537 | 1539 |
| |
| |||
1549 | 1551 |
| |
1550 | 1552 |
| |
1551 | 1553 |
| |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
1552 | 1557 |
| |
1553 | 1558 |
| |
1554 | 1559 |
| |
| |||
2914 | 2919 |
| |
2915 | 2920 |
| |
2916 | 2921 |
| |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
2917 | 2925 |
| |
2918 | 2926 |
| |
2919 | 2927 |
| |
|
Lines changed: 108 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| |||
386 | 387 |
| |
387 | 388 |
| |
388 | 389 |
| |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
389 | 404 |
| |
390 | 405 |
| |
391 | 406 |
| |
| |||
787 | 802 |
| |
788 | 803 |
| |
789 | 804 |
| |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
790 | 809 |
| |
791 | 810 |
| |
792 | 811 |
| |
| |||
3644 | 3663 |
| |
3645 | 3664 |
| |
3646 | 3665 |
| |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
3647 | 3708 |
| |
3648 | 3709 |
| |
3649 | 3710 |
| |
| |||
4533 | 4594 |
| |
4534 | 4595 |
| |
4535 | 4596 |
| |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
4536 | 4601 |
| |
4537 | 4602 |
| |
4538 | 4603 |
| |
| |||
5476 | 5541 |
| |
5477 | 5542 |
| |
5478 | 5543 |
| |
| 5544 | + | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
| 5550 | + | |
| 5551 | + | |
| 5552 | + | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
| 5561 | + | |
| 5562 | + | |
| 5563 | + | |
| 5564 | + | |
| 5565 | + | |
| 5566 | + | |
| 5567 | + | |
| 5568 | + | |
| 5569 | + | |
| 5570 | + | |
| 5571 | + | |
| 5572 | + | |
| 5573 | + | |
| 5574 | + | |
| 5575 | + | |
| 5576 | + | |
| 5577 | + | |
| 5578 | + | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
| 5582 | + | |
| 5583 | + | |
| 5584 | + | |
| 5585 | + | |
| 5586 | + | |
5479 | 5587 |
| |
5480 | 5588 |
| |
5481 | 5589 |
| |
|
Lines changed: 29 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
25 | 26 |
| |
26 | 27 |
| |
27 | 28 |
| |
| |||
1364 | 1365 |
| |
1365 | 1366 |
| |
1366 | 1367 |
| |
1367 |
| - | |
1368 |
| - | |
1369 |
| - | |
1370 |
| - | |
1371 |
| - | |
1372 | 1368 |
| |
1373 | 1369 |
| |
1374 | 1370 |
| |
| |||
1398 | 1394 |
| |
1399 | 1395 |
| |
1400 | 1396 |
| |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1401 | 1415 |
| |
1402 |
| - | |
1403 |
| - | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1404 | 1423 |
| |
1405 |
| - | |
1406 |
| - | |
1407 |
| - | |
1408 |
| - | |
1409 |
| - | |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
| 1424 | + | |
| 1425 | + | |
1416 | 1426 |
| |
| 1427 | + | |
1417 | 1428 |
| |
1418 | 1429 |
| |
1419 | 1430 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
650 | 650 |
| |
651 | 651 |
| |
652 | 652 |
| |
| 653 | + | |
653 | 654 |
| |
654 | 655 |
| |
655 | 656 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1015 | 1015 |
| |
1016 | 1016 |
| |
1017 | 1017 |
| |
| 1018 | + | |
1018 | 1019 |
| |
1019 | 1020 |
| |
1020 | 1021 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12667 | 12667 |
| |
12668 | 12668 |
| |
12669 | 12669 |
| |
| 12670 | + | |
12670 | 12671 |
| |
12671 | 12672 |
| |
12672 | 12673 |
| |
|
0 commit comments
Comments
(0)