forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite2090d9
committed
pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES
In commit23f34fa, we changed how ACLs were handled to use the newpg_init_privs catalog and to dump out the ACL commands as REVOKE+GRANTcombinations instead of trying to REVOKE all rights always and thenGRANT back just the ones which were in place.Unfortunately, the DEFAULT PRIVILEGES system didn't quite get thecorrect treatment with this change and ended up (incorrectly) onlyincluding positive GRANTs instead of both the REVOKEs and GRANTsnecessary to preserve the correct privileges.There are only a couple cases where such REVOKEs are possible because,generally speaking, there's few rights which exist on objects bydefault to be revoked.Examples of REVOKEs which weren't being correctly preserved are whenprivileges are REVOKE'd from the creator/owner, like so:ALTER DEFAULT PRIVILEGES FOR ROLE myrole REVOKE SELECT ON TABLES FROM myrole;or when other default privileges are being revoked, such as EXECUTErights granted to public for functions:ALTER DEFAULT PRIVILEGES FOR ROLE myrole REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;Fix this by correctly working out what the correct REVOKE statements are(if any) and dump them out, just as we do for everything else.Noticed while developing additional regression tests for pg_dump, whichwill be landing shortly.Back-patch to 9.6 where the bug was introduced.1 parent6af8b89 commite2090d9
4 files changed
+78
-15
lines changedLines changed: 16 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
364 | 364 |
| |
365 | 365 |
| |
366 | 366 |
| |
367 |
| - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
368 | 370 |
| |
369 | 371 |
| |
370 | 372 |
| |
371 |
| - | |
372 | 373 |
| |
373 | 374 |
| |
374 | 375 |
| |
| |||
384 | 385 |
| |
385 | 386 |
| |
386 | 387 |
| |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
391 | 400 |
| |
392 | 401 |
| |
393 | 402 |
| |
394 |
| - | |
| 403 | + | |
395 | 404 |
| |
396 | 405 |
| |
397 | 406 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
44 |
| - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 |
| |
46 | 48 |
| |
47 | 49 |
| |
|
Lines changed: 56 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8683 | 8683 |
| |
8684 | 8684 |
| |
8685 | 8685 |
| |
| 8686 | + | |
| 8687 | + | |
| 8688 | + | |
8686 | 8689 |
| |
8687 | 8690 |
| |
8688 | 8691 |
| |
| |||
8697 | 8700 |
| |
8698 | 8701 |
| |
8699 | 8702 |
| |
8700 |
| - | |
8701 |
| - | |
8702 |
| - | |
8703 |
| - | |
8704 |
| - | |
8705 |
| - | |
8706 |
| - | |
| 8703 | + | |
| 8704 | + | |
| 8705 | + | |
| 8706 | + | |
| 8707 | + | |
| 8708 | + | |
| 8709 | + | |
| 8710 | + | |
| 8711 | + | |
| 8712 | + | |
| 8713 | + | |
| 8714 | + | |
| 8715 | + | |
| 8716 | + | |
| 8717 | + | |
| 8718 | + | |
| 8719 | + | |
| 8720 | + | |
| 8721 | + | |
| 8722 | + | |
| 8723 | + | |
| 8724 | + | |
| 8725 | + | |
| 8726 | + | |
| 8727 | + | |
| 8728 | + | |
| 8729 | + | |
| 8730 | + | |
| 8731 | + | |
| 8732 | + | |
| 8733 | + | |
| 8734 | + | |
| 8735 | + | |
| 8736 | + | |
| 8737 | + | |
| 8738 | + | |
| 8739 | + | |
| 8740 | + | |
| 8741 | + | |
| 8742 | + | |
| 8743 | + | |
| 8744 | + | |
| 8745 | + | |
| 8746 | + | |
8707 | 8747 |
| |
8708 | 8748 |
| |
8709 | 8749 |
| |
| |||
8718 | 8758 |
| |
8719 | 8759 |
| |
8720 | 8760 |
| |
| 8761 | + | |
| 8762 | + | |
| 8763 | + | |
8721 | 8764 |
| |
8722 | 8765 |
| |
8723 | 8766 |
| |
| |||
8738 | 8781 |
| |
8739 | 8782 |
| |
8740 | 8783 |
| |
| 8784 | + | |
| 8785 | + | |
| 8786 | + | |
8741 | 8787 |
| |
8742 | 8788 |
| |
8743 | 8789 |
| |
| |||
14038 | 14084 |
| |
14039 | 14085 |
| |
14040 | 14086 |
| |
| 14087 | + | |
| 14088 | + | |
| 14089 | + | |
14041 | 14090 |
| |
14042 | 14091 |
| |
14043 | 14092 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
539 | 539 |
| |
540 | 540 |
| |
541 | 541 |
| |
| 542 | + | |
| 543 | + | |
| 544 | + | |
542 | 545 |
| |
543 | 546 |
| |
544 | 547 |
| |
|
0 commit comments
Comments
(0)