@@ -129,7 +129,7 @@ ProcessConfigFile(GucContext context)
129129/* Parse the file into a list of option names and values */
130130head = tail = NULL;
131131
132- if (!ParseConfigFile(ConfigFileName, NULL, 0, elevel, &head, &tail))
132+ if (!ParseConfigFile(ConfigFileName, NULL,true, 0, elevel, &head, &tail))
133133{
134134/* Syntax error(s) detected in the file, so bail out */
135135error = true;
@@ -363,7 +363,7 @@ ProcessConfigFile(GucContext context)
363363 * and absolute-ifying the path name if necessary.
364364 */
365365bool
366- ParseConfigFile (const char *config_file,const char *calling_file,
366+ ParseConfigFile (const char *config_file,const char *calling_file,bool strict,
367367int depth,int elevel,
368368ConfigVariable **head_p,
369369ConfigVariable **tail_p)
@@ -414,11 +414,19 @@ ParseConfigFile(const char *config_file, const char *calling_file,
414414fp =AllocateFile (config_file," r" );
415415if (!fp)
416416{
417- ereport (elevel,
418- (errcode_for_file_access (),
419- errmsg (" could not open configuration file\" %s\" : %m" ,
417+ if (strict)
418+ {
419+ ereport (elevel,
420+ (errcode_for_file_access (),
421+ errmsg (" could not open configuration file\" %s\" : %m" ,
422+ config_file)));
423+ return false ;
424+ }
425+
426+ ereport (LOG,
427+ (errmsg (" skipping missing configuration file\" %s\" " ,
420428config_file)));
421- return false ;
429+ return OK ;
422430}
423431
424432OK =ParseConfigFp (fp, config_file, depth, elevel, head_p, tail_p);
@@ -512,15 +520,32 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
512520}
513521
514522/* OK, process the option name and value */
515- if (guc_name_compare (opt_name," include" ) ==0 )
523+ if (guc_name_compare (opt_name," include_if_exists" ) ==0 )
524+ {
525+ /*
526+ * An include_if_exists directive isn't a variable and should be
527+ * processed immediately.
528+ */
529+ unsigned int save_ConfigFileLineno = ConfigFileLineno;
530+
531+ if (!ParseConfigFile (opt_value, config_file,false ,
532+ depth +1 , elevel,
533+ head_p, tail_p))
534+ OK =false ;
535+ yy_switch_to_buffer (lex_buffer);
536+ ConfigFileLineno = save_ConfigFileLineno;
537+ pfree (opt_name);
538+ pfree (opt_value);
539+ }
540+ else if (guc_name_compare (opt_name," include" ) ==0 )
516541{
517542/*
518543 * An include directive isn't a variable and should be processed
519544 * immediately.
520545 */
521546unsigned int save_ConfigFileLineno = ConfigFileLineno;
522547
523- if (!ParseConfigFile (opt_value, config_file,
548+ if (!ParseConfigFile (opt_value, config_file,true ,
524549 depth +1 , elevel,
525550 head_p, tail_p))
526551OK =false ;