@@ -111,8 +111,6 @@ ProcessConfigFile(GucContext context)
111
111
ConfigVariable *item,
112
112
*head,
113
113
*tail;
114
- char *cvc = NULL;
115
- struct config_string *cvc_struct;
116
114
int i;
117
115
118
116
/*
@@ -138,50 +136,6 @@ ProcessConfigFile(GucContext context)
138
136
goto cleanup_list;
139
137
}
140
138
141
- /*
142
- * We need the proposed new value of custom_variable_classes to check
143
- * custom variables with. ParseConfigFile ensured that if it' s in
144
- * the file, it' s first in the list. But first check to see if we
145
- * have an active value from the command line, which should override
146
- * the file in any case. (Since there' s no relevant env var, the
147
- * only possible nondefault sources are the file and ARGV.)
148
- */
149
- cvc_struct = (struct config_string *)
150
- find_option (" custom_variable_classes" , false , elevel);
151
- Assert (cvc_struct);
152
- if (cvc_struct->gen.reset_source > PGC_S_FILE)
153
- {
154
- cvc = guc_strdup (elevel, cvc_struct->reset_val );
155
- if (cvc == NULL )
156
- {
157
- error = true ;
158
- goto cleanup_list;
159
- }
160
- }
161
- else if (head != NULL &&
162
- guc_name_compare (head->name, " custom_variable_classes" ) == 0)
163
- {
164
- /*
165
- * Need to canonicalize the value by calling the check hook.
166
- */
167
- void *extra = NULL ;
168
-
169
- cvc = guc_strdup (elevel, head->value );
170
- if (cvc == NULL )
171
- {
172
- error = true ;
173
- goto cleanup_list;
174
- }
175
- if (!call_string_check_hook (cvc_struct, &cvc, &extra,
176
- PGC_S_FILE, elevel))
177
- {
178
- error = true ;
179
- goto cleanup_list;
180
- }
181
- if (extra)
182
- free (extra);
183
- }
184
-
185
139
/*
186
140
* Mark all extant GUC variables as not present in the config file.
187
141
* We need this so that we can tell below which ones have been removed
@@ -199,39 +153,29 @@ ProcessConfigFile(GucContext context)
199
153
* quasi-syntactic check on the validity of the config file. It is
200
154
* important that the postmaster and all backends agree on the results
201
155
* of this phase, else we will have strange inconsistencies about which
202
- * processes accept a config file update and which don't. Hence, custom
203
- * variable names can only be checked against custom_variable_classes,
204
- * not against any loadable modules that might (or might not) be present.
205
- * Likewise, we don't attempt to validate the options' values here.
156
+ * processes accept a config file update and which don' t. Hence, unknown
157
+ * custom variable names have to be accepted without complaint. For the
158
+ * same reason, we don' t attempt to validate the options' values here.
206
159
*
207
160
* In addition, the GUC_IS_IN_FILE flag is set on each existing GUC
208
161
* variable mentioned in the file.
209
162
*/
210
163
for (item = head; item; item = item->next)
211
164
{
212
- char *sep = strchr (item->name , GUC_QUALIFIER_SEPARATOR);
213
165
struct config_generic *record;
214
166
215
- if (sep)
216
- {
217
- /* Custom variable, so check against custom_variable_classes */
218
- if (!is_custom_class (item->name , sep - item->name , cvc))
219
- {
220
- ereport (elevel,
221
- (errcode (ERRCODE_UNDEFINED_OBJECT),
222
- errmsg (" unrecognized configuration parameter \" %s\" in file \" %s\" line %u" ,
223
- item->name ,
224
- item->filename , item->sourceline )));
225
- error = true ;
226
- continue ;
227
- }
228
- }
229
-
167
+ /*
168
+ * Try to find the variable; but do not create a custom placeholder
169
+ * if it's not there already.
170
+ */
230
171
record = find_option (item->name , false , elevel);
231
172
232
173
if (record)
174
+ {
175
+ /* Found, so mark it as present in file */
233
176
record->status |= GUC_IS_IN_FILE;
234
- else if (!sep)
177
+ }
178
+ else if (strchr (item->name , GUC_QUALIFIER_SEPARATOR) == NULL )
235
179
{
236
180
/* Invalid non-custom variable, so complain */
237
181
ereport (elevel,
@@ -382,8 +326,6 @@ ProcessConfigFile(GucContext context)
382
326
383
327
cleanup_list:
384
328
FreeConfigVariables (head);
385
- if (cvc)
386
- free (cvc);
387
329
388
330
if (error)
389
331
{
@@ -581,40 +523,6 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
581
523
pfree (opt_name);
582
524
pfree (opt_value);
583
525
}
584
- else if (guc_name_compare (opt_name, " custom_variable_classes" ) == 0 )
585
- {
586
- /*
587
- * This variable must be processed first as it controls
588
- * the validity of other variables; so it goes at the head
589
- * of the result list. If we already found a value for it,
590
- * replace with this one.
591
- */
592
- item = *head_p;
593
- if (item != NULL &&
594
- guc_name_compare (item->name , " custom_variable_classes" ) == 0 )
595
- {
596
- /* replace existing head item */
597
- pfree (item->name );
598
- pfree (item->value );
599
- item->name = opt_name;
600
- item->value = opt_value;
601
- item->filename = pstrdup (config_file);
602
- item->sourceline = ConfigFileLineno-1 ;
603
- }
604
- else
605
- {
606
- /* prepend to list */
607
- item = palloc (sizeof *item);
608
- item->name = opt_name;
609
- item->value = opt_value;
610
- item->filename = pstrdup (config_file);
611
- item->sourceline = ConfigFileLineno-1 ;
612
- item->next = *head_p;
613
- *head_p = item;
614
- if (*tail_p == NULL )
615
- *tail_p = item;
616
- }
617
- }
618
526
else
619
527
{
620
528
/* ordinary variable, append to list */
0 commit comments