forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitba6f629
committed
Improve and simplify CREATE EXTENSION's management of GUC variables.
CREATE EXTENSION needs to transiently set search_path, as well asclient_min_messages and log_min_messages. We were doing this by theexpedient of saving the current string value of each variable, doing aSET LOCAL, and then doing another SET LOCAL with the previous value atthe end of the command. This is a bit expensive though, and it also failsbadly if there is anything funny about the existing search_path value,as seen in a recent report from Roger Niederland. Fortunately, there's amuch better way, which is to piggyback on the GUC infrastructure previouslydeveloped for functions with SET options. We just open a new GUC nestinglevel, do our assignments with GUC_ACTION_SAVE, and then close the nestinglevel when done. This automatically restores the prior settings without are-parsing pass, so (in principle anyway) there can't be an error. Andguc.c still takes care of cleanup in event of an error abort.The CREATE EXTENSION code for this was modeled on some much older code inri_triggers.c, which I also changed to use the better method, even thoughthere wasn't really much risk of failure there. Also improve the commentsin guc.c to reflect this additional usage.1 parent3919ad8 commitba6f629
File tree
4 files changed
+34
-48
lines changed- src
- backend
- commands
- utils
- adt
- misc
- include/utils
4 files changed
+34
-48
lines changedLines changed: 13 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
774 | 774 |
| |
775 | 775 |
| |
776 | 776 |
| |
777 |
| - | |
778 |
| - | |
779 |
| - | |
| 777 | + | |
780 | 778 |
| |
781 | 779 |
| |
782 | 780 |
| |
| |||
808 | 806 |
| |
809 | 807 |
| |
810 | 808 |
| |
811 |
| - | |
812 |
| - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
813 | 812 |
| |
814 |
| - | |
815 |
| - | |
| 813 | + | |
| 814 | + | |
816 | 815 |
| |
817 | 816 |
| |
818 | 817 |
| |
819 |
| - | |
820 |
| - | |
821 |
| - | |
822 |
| - | |
| 818 | + | |
823 | 819 |
| |
824 | 820 |
| |
825 | 821 |
| |
826 |
| - | |
| 822 | + | |
827 | 823 |
| |
828 | 824 |
| |
829 | 825 |
| |
| |||
832 | 828 |
| |
833 | 829 |
| |
834 | 830 |
| |
835 |
| - | |
| 831 | + | |
| 832 | + | |
836 | 833 |
| |
837 |
| - | |
838 |
| - | |
839 | 834 |
| |
840 | 835 |
| |
841 | 836 |
| |
| |||
849 | 844 |
| |
850 | 845 |
| |
851 | 846 |
| |
852 |
| - | |
| 847 | + | |
853 | 848 |
| |
854 | 849 |
| |
855 | 850 |
| |
| |||
910 | 905 |
| |
911 | 906 |
| |
912 | 907 |
| |
913 |
| - | |
914 |
| - | |
| 908 | + | |
915 | 909 |
| |
916 |
| - | |
917 |
| - | |
918 |
| - | |
919 |
| - | |
920 |
| - | |
921 |
| - | |
922 |
| - | |
923 |
| - | |
924 |
| - | |
| 910 | + | |
925 | 911 |
| |
926 | 912 |
| |
927 | 913 |
| |
|
Lines changed: 9 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2633 | 2633 |
| |
2634 | 2634 |
| |
2635 | 2635 |
| |
2636 |
| - | |
| 2636 | + | |
2637 | 2637 |
| |
2638 | 2638 |
| |
2639 | 2639 |
| |
| |||
2772 | 2772 |
| |
2773 | 2773 |
| |
2774 | 2774 |
| |
2775 |
| - | |
2776 |
| - | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
2777 | 2778 |
| |
2778 |
| - | |
| 2779 | + | |
| 2780 | + | |
2779 | 2781 |
| |
2780 | 2782 |
| |
2781 | 2783 |
| |
2782 |
| - | |
| 2784 | + | |
2783 | 2785 |
| |
2784 | 2786 |
| |
2785 | 2787 |
| |
| |||
2862 | 2864 |
| |
2863 | 2865 |
| |
2864 | 2866 |
| |
2865 |
| - | |
2866 |
| - | |
| 2867 | + | |
2867 | 2868 |
| |
2868 |
| - | |
2869 |
| - | |
2870 |
| - | |
2871 |
| - | |
| 2869 | + | |
2872 | 2870 |
| |
2873 | 2871 |
| |
2874 | 2872 |
| |
|
Lines changed: 11 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4329 | 4329 |
| |
4330 | 4330 |
| |
4331 | 4331 |
| |
4332 |
| - | |
4333 |
| - | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
4334 | 4335 |
| |
4335 | 4336 |
| |
4336 | 4337 |
| |
| |||
4340 | 4341 |
| |
4341 | 4342 |
| |
4342 | 4343 |
| |
4343 |
| - | |
4344 |
| - | |
| 4344 | + | |
| 4345 | + | |
| 4346 | + | |
4345 | 4347 |
| |
4346 | 4348 |
| |
4347 | 4349 |
| |
| |||
4374 | 4376 |
| |
4375 | 4377 |
| |
4376 | 4378 |
| |
4377 |
| - | |
4378 |
| - | |
4379 |
| - | |
4380 |
| - | |
4381 |
| - | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
4382 | 4384 |
| |
4383 | 4385 |
| |
4384 | 4386 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 |
| - | |
| 158 | + | |
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
|
0 commit comments
Comments
(0)