pg_parser_continue_on_error_v2a_delta.patch
application/octet-stream
Filename: pg_parser_continue_on_error_v2a_delta.patch
Type: application/octet-stream
Part: 0
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index ed5c77f..ec001d6 100644
*** a/src/backend/utils/misc/guc-file.l
--- b/src/backend/utils/misc/guc-file.l
*************** ProcessConfigFile(GucContext context)
*** 110,132 ****
*tail;
char *cvc = NULL;
struct config_string *cvc_struct;
! int i;
bool OK = true;
Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
! if (context == PGC_SIGHUP)
! {
! /*
! * To avoid cluttering the log, only the postmaster bleats loudly
! * about problems with the config file.
! */
! elevel = IsUnderPostmaster ? DEBUG2 : LOG;
! }
! else
! elevel = LOG;
!
! /* Parse the file into a list of option names and values */
head = tail = NULL;
if (!ParseConfigFile(ConfigFileName, NULL, 0, elevel, &head, &tail))
--- 110,135 ----
*tail;
char *cvc = NULL;
struct config_string *cvc_struct;
! int i;
bool OK = true;
+ /* Config files are only processes on startup (by the postmaster)
+ * and on SIGUP (by the postmaster and backends)
+ */
Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
+ Assert(!(context == PGC_POSTMATER && IsUnderPostmaster));
! /*
! * To avoid cluttering the log, only the postmaster bleats loudly
! * about problems with the config file.
! */
! elevel = IsUnderPostmaster ? DEBUG2 : LOG;
!
! /* Parse the file into a list of option names and values.
! * We continue even if we hit a parse errors because we
! * also want to report invalid value in the parts we
! * could parse
! */
head = tail = NULL;
if (!ParseConfigFile(ConfigFileName, NULL, 0, elevel, &head, &tail))
*************** ProcessConfigFile(GucContext context)
*** 223,231 ****
if (!set_config_option(item->name, item->value, context,
PGC_S_FILE, GUC_ACTION_SET, false))
OK = false;
- /* stop at the first error if we are postmaster's child */
- if (IsUnderPostmaster && !OK)
- break;
}
/* Don't change configuration options if errors were detected earlier */
if (!OK)
--- 226,231 ----
*************** ParseConfigFp(FILE *fp, const char *conf
*** 592,598 ****
/* skip over parse_error if we made it this far without errors */
continue;
! parse_error:
if (token == GUC_EOL || token == 0)
ereport(elevel,
(errcode(ERRCODE_SYNTAX_ERROR),
--- 592,598 ----
/* skip over parse_error if we made it this far without errors */
continue;
! parse_error:
if (token == GUC_EOL || token == 0)
ereport(elevel,
(errcode(ERRCODE_SYNTAX_ERROR),
*************** ParseConfigFp(FILE *fp, const char *conf
*** 605,611 ****
config_file, ConfigFileLineno, yytext)));
errorcount++;
/* fast forward till the next EOL/EOF */
! while (token && token != GUC_EOL)
token = yylex();
/* break out of loop on EOF */
--- 605,611 ----
config_file, ConfigFileLineno, yytext)));
errorcount++;
/* fast forward till the next EOL/EOF */
! while (token != 0 && token != GUC_EOL)
token = yylex();
/* break out of loop on EOF */
*************** ParseConfigFp(FILE *fp, const char *conf
*** 613,619 ****
break;
/* avoid producing too much noise when parsing a bogus file */
! if (IsUnderPostmaster || errorcount >= 100)
break;
}
--- 613,619 ----
break;
/* avoid producing too much noise when parsing a bogus file */
! if (errorcount >= 100)
break;
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 3088ccc..fc195c5 100644
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
*************** config_enum_get_options(struct config_en
*** 5055,5061 ****
*
* If there is an error (non-existing option, invalid value) then an
* ereport(ERROR) is thrown *unless* this is called in a context where we
! * don't want to ereport (currently, startup or SIGHUP config file reread).
* In that case we write a suitable error message via ereport(LOG) and
* return false. This is working around the deficiencies in the ereport
* mechanism, so don't blame me. In all other cases, the function
--- 5055,5061 ----
*
* If there is an error (non-existing option, invalid value) then an
* ereport(ERROR) is thrown *unless* this is called in a context where we
! * don't want to ereport (currently, settings defaults and cfg file reading)
* In that case we write a suitable error message via ereport(LOG) and
* return false. This is working around the deficiencies in the ereport
* mechanism, so don't blame me. In all other cases, the function