- Notifications
You must be signed in to change notification settings - Fork28
Commit7428699
committed
Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c.
Code that prints out the contents of setconfig or proconfig arrays inSQL format needs to handle GUC_LIST_QUOTE variables differently fromother ones, because for those variables, flatten_set_variable_args()already applied a layer of quoting. The value can therefore safelybe printed as-is, and indeed must be, or flatten_set_variable_args()will muck it up completely on reload. For all other GUC variables,it's necessary and sufficient to quote the value as a SQL literal.We'd recognized the need for this long ago, but mis-analyzed theneed slightly, thinking that all GUC_LIST_INPUT variables neededthe special treatment. That's actually wrong, since a valid valueof a LIST variable might include characters that need quoting,although no existing variables accept such values.More to the point, we hadn't made any particular effort to keep thevarious places that deal with this up-to-date with the set of variablesthat actually need special treatment, meaning that we'd do the wrongthing with, for example, temp_tablespaces values. This affects dumpingof SET clauses attached to functions, as well as ALTER DATABASE/ROLE SETcommands.In ruleutils.c we can fix it reasonably honestly by exporting a guc.cfunction that allows discovering the flags for a given GUC variable.But pg_dump doesn't have easy access to that, so continue the old methodof having a hard-wired list of affected variable names. At least we canfix it to have just one list not two, and update the list to matchcurrent reality.A remaining problem with this is that it only works for built-inGUC variables. pg_dump's list obvious knows nothing of third-partyextensions, and even the "ask guc.c" method isn't bulletproof sincethe relevant extension might not be loaded. There's no obvioussolution to that, so for now, we'll just have to discourage extensionauthors from inventing custom GUCs that need GUC_LIST_QUOTE.This has been busted for a long time, so back-patch to all supportedbranches.Michael Paquier and Tom Lane, reviewed by Kyotaro Horiguchi andPavel StehuleDiscussion:https://postgr.es/m/20180111064900.GA51030@paquier.xyz1 parent0f0deb7 commit7428699
File tree
8 files changed
+117
-14
lines changed- src
- backend/utils
- adt
- misc
- bin/pg_dump
- include/utils
- test/regress
- expected
- sql
8 files changed
+117
-14
lines changedLines changed: 9 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
64 | 65 |
| |
65 | 66 |
| |
66 | 67 |
| |
| |||
2597 | 2598 |
| |
2598 | 2599 |
| |
2599 | 2600 |
| |
2600 |
| - | |
2601 |
| - | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
2602 | 2608 |
| |
2603 |
| - | |
2604 |
| - | |
| 2609 | + | |
2605 | 2610 |
| |
2606 | 2611 |
| |
2607 | 2612 |
| |
|
Lines changed: 26 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
796 | 796 |
| |
797 | 797 |
| |
798 | 798 |
| |
799 |
| - | |
800 |
| - | |
| 799 | + | |
| 800 | + | |
801 | 801 |
| |
802 | 802 |
| |
803 | 803 |
| |
| |||
6859 | 6859 |
| |
6860 | 6860 |
| |
6861 | 6861 |
| |
| 6862 | + | |
| 6863 | + | |
| 6864 | + | |
| 6865 | + | |
| 6866 | + | |
| 6867 | + | |
| 6868 | + | |
| 6869 | + | |
| 6870 | + | |
| 6871 | + | |
| 6872 | + | |
| 6873 | + | |
| 6874 | + | |
| 6875 | + | |
| 6876 | + | |
| 6877 | + | |
| 6878 | + | |
| 6879 | + | |
| 6880 | + | |
| 6881 | + | |
| 6882 | + | |
| 6883 | + | |
| 6884 | + | |
| 6885 | + | |
6862 | 6886 |
| |
6863 | 6887 |
| |
6864 | 6888 |
| |
|
Lines changed: 31 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
850 | 850 |
| |
851 | 851 |
| |
852 | 852 |
| |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
853 | 876 |
| |
854 | 877 |
| |
855 | 878 |
| |
| |||
887 | 910 |
| |
888 | 911 |
| |
889 | 912 |
| |
890 |
| - | |
891 |
| - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
892 | 920 |
| |
893 |
| - | |
894 |
| - | |
| 921 | + | |
895 | 922 |
| |
896 | 923 |
| |
897 | 924 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
| 59 | + | |
| 60 | + | |
59 | 61 |
| |
60 | 62 |
| |
61 | 63 |
| |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11877 | 11877 |
| |
11878 | 11878 |
| |
11879 | 11879 |
| |
11880 |
| - | |
11881 |
| - | |
| 11880 | + | |
| 11881 | + | |
| 11882 | + | |
| 11883 | + | |
| 11884 | + | |
| 11885 | + | |
| 11886 | + | |
11882 | 11887 |
| |
11883 |
| - | |
11884 |
| - | |
| 11888 | + | |
11885 | 11889 |
| |
11886 | 11890 |
| |
11887 | 11891 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
349 | 349 |
| |
350 | 350 |
| |
351 | 351 |
| |
| 352 | + | |
352 | 353 |
| |
353 | 354 |
| |
354 | 355 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3149 | 3149 |
| |
3150 | 3150 |
| |
3151 | 3151 |
| |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
3152 | 3179 |
| |
3153 | 3180 |
| |
3154 | 3181 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1155 | 1155 |
| |
1156 | 1156 |
| |
1157 | 1157 |
| |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
1158 | 1171 |
| |
1159 | 1172 |
| |
1160 | 1173 |
| |
|
0 commit comments
Comments
(0)