forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6b71c92
committed
Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership.
If recordDependencyOnCurrentExtension is invoked on a pre-existing,free-standing object during an extension update script, that objectwill become owned by the extension. In our current code this ispossible in three cases:* Replacing a "shell" type or operator.* CREATE OR REPLACE overwriting an existing object.* ALTER TYPE SET, ALTER DOMAIN SET, and ALTER OPERATOR SET.The first of these cases is intentional behavior, as noted by theexisting comments for GenerateTypeDependencies. It seems likeappropriate behavior for CREATE OR REPLACE too; at least, the obviousalternatives are not better. However, the fact that it happens duringALTER is an artifact of trying to share code (GenerateTypeDependenciesand makeOperatorDependencies) between the CREATE and ALTER cases.Since an extension script would be unlikely to ALTER an object thatdidn't already belong to the extension, this behavior is not verytroubling for the direct target object ... but ALTER TYPE SET willrecurse to dependent domains, and it is very uncool for those tobecome owned by the extension if they were not already.Let's fix this by redefining the ALTER cases to never change extensionmembership, full stop. We could minimize the behavioral change byonly changing the behavior when ALTER TYPE SET is recursing to adomain, but that would complicate the code and it does not seem likea better definition.Per bug #17144 from Alex Kozhemyakin. Back-patch to v13 where ALTERTYPE SET was added. (The other cases are older, but since they onlyaffect the directly-named object, there's not enough of a problem tojustify changing the behavior further back.)Discussion:https://postgr.es/m/17144-e67d7a8f049de9af@postgresql.org1 parentb66336c commit6b71c92
File tree
7 files changed
+41
-14
lines changed- src
- backend
- catalog
- commands
- include/catalog
7 files changed
+41
-14
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
182 | 189 |
| |
183 | 190 |
| |
184 | 191 |
| |
|
Lines changed: 11 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
268 | 268 |
| |
269 | 269 |
| |
270 | 270 |
| |
271 |
| - | |
| 271 | + | |
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
| |||
546 | 546 |
| |
547 | 547 |
| |
548 | 548 |
| |
549 |
| - | |
| 549 | + | |
550 | 550 |
| |
551 | 551 |
| |
552 | 552 |
| |
| |||
766 | 766 |
| |
767 | 767 |
| |
768 | 768 |
| |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
769 | 773 |
| |
770 | 774 |
| |
771 | 775 |
| |
772 | 776 |
| |
773 |
| - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
774 | 780 |
| |
775 | 781 |
| |
776 | 782 |
| |
| |||
857 | 863 |
| |
858 | 864 |
| |
859 | 865 |
| |
860 |
| - | |
| 866 | + | |
| 867 | + | |
861 | 868 |
| |
862 | 869 |
| |
863 | 870 |
|
Lines changed: 16 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
167 | 167 |
| |
168 | 168 |
| |
169 | 169 |
| |
| 170 | + | |
170 | 171 |
| |
171 | 172 |
| |
172 | 173 |
| |
| |||
504 | 505 |
| |
505 | 506 |
| |
506 | 507 |
| |
| 508 | + | |
507 | 509 |
| |
508 | 510 |
| |
509 | 511 |
| |
| |||
537 | 539 |
| |
538 | 540 |
| |
539 | 541 |
| |
540 |
| - | |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
545 |
| - | |
546 |
| - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
547 | 553 |
| |
548 | 554 |
| |
549 | 555 |
| |
| |||
553 | 559 |
| |
554 | 560 |
| |
555 | 561 |
| |
| 562 | + | |
556 | 563 |
| |
557 | 564 |
| |
558 | 565 |
| |
| |||
611 | 618 |
| |
612 | 619 |
| |
613 | 620 |
| |
614 |
| - | |
| 621 | + | |
| 622 | + | |
615 | 623 |
| |
616 | 624 |
| |
617 | 625 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
542 | 542 |
| |
543 | 543 |
| |
544 | 544 |
| |
545 |
| - | |
| 545 | + | |
546 | 546 |
| |
547 | 547 |
| |
548 | 548 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2675 | 2675 |
| |
2676 | 2676 |
| |
2677 | 2677 |
| |
| 2678 | + | |
2678 | 2679 |
| |
2679 | 2680 |
| |
2680 | 2681 |
| |
| |||
4415 | 4416 |
| |
4416 | 4417 |
| |
4417 | 4418 |
| |
| 4419 | + | |
4418 | 4420 |
| |
4419 | 4421 |
| |
4420 | 4422 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
101 |
| - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
102 | 104 |
| |
103 | 105 |
| |
104 | 106 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
386 | 386 |
| |
387 | 387 |
| |
388 | 388 |
| |
| 389 | + | |
389 | 390 |
| |
390 | 391 |
| |
391 | 392 |
| |
|
0 commit comments
Comments
(0)