*** a/src/backend/utils/misc/guc-file.l --- b/src/backend/utils/misc/guc-file.l *************** *** 129,135 **** ProcessConfigFile(GucContext context) --- 129,141 ---- head = tail = NULL; if (!ParseConfigFile(ConfigFileName, NULL, 0, elevel, &head, &tail)) + { + ereport(elevel, + (errcode(ERRCODE_CONFIG_FILE_ERROR), + errmsg("Did not reload \"%s\" due to earlier parsing error(s)", + ConfigFileName))); goto cleanup_list; + } /* * We need the proposed new value of custom_variable_classes to check *************** *** 354,360 **** ParseConfigFile(const char *config_file, const char *calling_file, ConfigVariable **head_p, ConfigVariable **tail_p) { ! bool OK = true; FILE *fp; char abs_path[MAXPGPATH]; --- 360,366 ---- ConfigVariable **head_p, ConfigVariable **tail_p) { ! bool ok = true; FILE *fp; char abs_path[MAXPGPATH]; *************** *** 407,417 **** ParseConfigFile(const char *config_file, const char *calling_file, return false; } ! OK = ParseConfigFp(fp, config_file, depth, elevel, head_p, tail_p); FreeFile(fp); ! return OK; } /* --- 413,423 ---- return false; } ! ok = ParseConfigFp(fp, config_file, depth, elevel, head_p, tail_p); FreeFile(fp); ! return ok; } /* *************** *** 444,452 **** bool ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p) { ! bool OK = true; YY_BUFFER_STATE lex_buffer; ! int token; /* * Parse --- 450,459 ---- ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p) { ! bool ok = true; YY_BUFFER_STATE lex_buffer; ! int token, ! errorno; /* * Parse *************** *** 455,460 **** ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, --- 462,468 ---- yy_switch_to_buffer(lex_buffer); ConfigFileLineno = 1; + errorno = 0; /* This loop iterates once per logical line */ while ((token = yylex())) *************** *** 512,519 **** ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, { pfree(opt_name); pfree(opt_value); ! OK = false; ! goto cleanup_exit; } yy_switch_to_buffer(lex_buffer); ConfigFileLineno = save_ConfigFileLineno; --- 520,526 ---- { pfree(opt_name); pfree(opt_value); ! goto parse_error; } yy_switch_to_buffer(lex_buffer); ConfigFileLineno = save_ConfigFileLineno; *************** *** 573,599 **** ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, /* break out of loop if read EOF, else loop for next line */ if (token == 0) break; } /* successful completion of parsing */ - goto cleanup_exit; - - parse_error: - if (token == GUC_EOL || token == 0) - ereport(elevel, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("syntax error in file \"%s\" line %u, near end of line", - config_file, ConfigFileLineno - 1))); - else - ereport(elevel, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("syntax error in file \"%s\" line %u, near token \"%s\"", - config_file, ConfigFileLineno, yytext))); - OK = false; - - cleanup_exit: yy_delete_buffer(lex_buffer); ! return OK; } --- 580,609 ---- /* break out of loop if read EOF, else loop for next line */ if (token == 0) break; + + /* skip over parse_error if we made it this far without error */ + continue; + + parse_error: + if (token == GUC_EOL || token == 0) + ereport(elevel, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error in file \"%s\" line %u, near end of line", + config_file, ConfigFileLineno - 1))); + else + ereport(elevel, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error in file \"%s\" line %u, near token \"%s\"", + config_file, ConfigFileLineno, yytext))); + ok = false; + /* avoid excessive bloat of the log file */ + if (IsUnderPostmaster || ++errorno >= 100) + break; } /* successful completion of parsing */ yy_delete_buffer(lex_buffer); ! return ok; }