285{
287 bool applying = false;
288 const char *ConfFileWithError;
290 *tail;
293
294
296 head = tail = NULL;
297
300 &head, &tail))
301 {
302
305 }
306
307
308
309
310
311
312
314 {
317 &head, &tail))
318 {
319
323 }
324 }
325 else
326 {
327
328
329
330
331
332
333
334
336
337
338
339
341 {
342 if (!item->ignore &&
343 strcmp(item->name, "data_directory") == 0)
344 newlist = item;
345 }
346
347 if (newlist)
348 newlist->
next = NULL;
349 head = tail = newlist;
350
351
352
353
354
355
356
357
358 if (head == NULL)
360 }
361
362
363
364
365
366
369 {
371
372 gconf->
status &= ~GUC_IS_IN_FILE;
373 }
374
375
376
377
378
379
380
381
382
383
384
385
386
387
389 {
391
392
393 if (item->ignore)
394 continue;
395
396
397
398
399
400 record =
find_option(item->name,
false,
true, elevel);
401
402 if (record)
403 {
404
406 {
407
408
409
410
411
413 {
414 if (!pitem->ignore &&
415 strcmp(pitem->name, item->name) == 0)
416 pitem->ignore = true;
417 }
418 }
419
421 }
423 {
424
426 (
errcode(ERRCODE_UNDEFINED_OBJECT),
427 errmsg(
"unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
428 item->name,
429 item->filename, item->sourceline)));
430 item->errmsg =
pstrdup(
"unrecognized configuration parameter");
432 ConfFileWithError = item->filename;
433 }
434 }
435
436
437
438
439
442
443
444 applying = true;
445
446
447
448
449
450
451
454 {
456
459 continue;
461 {
462
465 (
errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
466 errmsg(
"parameter \"%s\" cannot be changed without restarting the server",
470 NULL, 0,
471 &head, &tail);
473 continue;
474 }
475
476
477 if (!applySettings)
478 continue;
479
480
481
482
483
489 {
492 }
493
494
498 {
499
502 (
errmsg(
"parameter \"%s\" removed from configuration file, reset to default",
504 }
505 }
506
507
508
509
510
511
512
513
514
515
516
517
518
519
521 {
524
527 }
528
529
530
531
533 {
534 char *pre_value = NULL;
535 int scres;
536
537
538 if (item->ignore)
539 continue;
540
541
543 {
545
546
547 if (!preval)
548 preval = "";
549
551 }
552
556 if (scres > 0)
557 {
558
559 if (pre_value)
560 {
562
563 if (!post_value)
564 post_value = "";
565 if (strcmp(pre_value, post_value) != 0)
567 (
errmsg(
"parameter \"%s\" changed to \"%s\"",
568 item->name, item->value)));
569 }
570 item->applied = true;
571 }
572 else if (scres == 0)
573 {
575 item->errmsg =
pstrdup(
"setting could not be applied");
576 ConfFileWithError = item->filename;
577 }
578 else
579 {
580
581 item->applied = true;
582 }
583
584
585
586
587
588
589
590 if (scres != 0 && applySettings)
592 item->sourceline);
593
594 if (pre_value)
596 }
597
598
599 if (applySettings)
601
603 if (
error && applySettings)
604 {
605
608 (
errcode(ERRCODE_CONFIG_FILE_ERROR),
609 errmsg(
"configuration file \"%s\" contains errors",
610 ConfFileWithError)));
611 else if (applying)
613 (
errcode(ERRCODE_CONFIG_FILE_ERROR),
614 errmsg(
"configuration file \"%s\" contains errors; unaffected changes were applied",
615 ConfFileWithError)));
616 else
618 (
errcode(ERRCODE_CONFIG_FILE_ERROR),
619 errmsg(
"configuration file \"%s\" contains errors; no changes were applied",
620 ConfFileWithError)));
621 }
622
623
624 return head;
625}
TimestampTz GetCurrentTimestamp(void)
#define CONF_FILE_START_DEPTH
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void record_config_file_error(const char *errmsg, const char *config_file, int lineno, ConfigVariable **head_p, ConfigVariable **tail_p)
bool ParseConfigFile(const char *config_file, bool strict, const char *calling_file, int calling_lineno, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
static void set_config_sourcefile(const char *name, char *sourcefile, int sourceline)
static bool valid_custom_variable_name(const char *name)
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
const char * GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
static void pg_timezone_abbrev_initialize(void)
struct config_generic * find_option(const char *name, bool create_placeholders, bool skip_errors, int elevel)
static void InitializeGUCOptionsFromEnvironment(void)
static void set_guc_source(struct config_generic *gconf, GucSource newsource)
static HTAB * guc_hashtab
int set_config_option(const char *name, const char *value, GucContext context, GucSource source, GucAction action, bool changeVal, int elevel, bool is_reload)
#define PG_AUTOCONF_FILENAME
#define GUC_PENDING_RESTART
const char * GetDatabaseEncodingName(void)
char * pstrdup(const char *in)
void pfree(void *pointer)
static void bail_out(bool noatexit, const char *fmt,...) pg_attribute_printf(2
char * psprintf(const char *fmt,...)
struct ConfigVariable * next
struct config_generic * gucvar