From b120485f9cf55e96e8b945df12303c9ea8ef94b7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 24 Sep 2004 19:43:03 +0000 Subject: GUC assign hooks that look at external state in deciding whether a setting is valid must ignore that state and permit the assignment anyway when source is PGC_S_OVERRIDE. Otherwise they may disallow a rollback at transaction abort, which is The Wrong Thing. Per example from Michael Fuhr 12-Sep-04. --- src/backend/utils/misc/guc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/misc/guc.c') diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 436c57b750f..4fb2fad4a6b 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.238 2004/08/31 22:43:58 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.239 2004/09/24 19:43:03 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -5532,7 +5532,8 @@ assign_stage_log_stats(bool newval, bool doit, GucSource source) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot enable parameter when \"log_statement_stats\" is true"))); - else + /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */ + else if (source != PGC_S_OVERRIDE) return false; } return true; @@ -5550,7 +5551,8 @@ assign_log_stats(bool newval, bool doit, GucSource source) errmsg("cannot enable \"log_statement_stats\" when " "\"log_parser_stats\", \"log_planner_stats\", " "or \"log_executor_stats\" is true"))); - else + /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */ + else if (source != PGC_S_OVERRIDE) return false; } return true; @@ -5566,7 +5568,9 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot set transaction read-write mode inside a read-only transaction"))); - return false; + /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */ + else if (source != PGC_S_OVERRIDE) + return false; } return true; } -- cgit v1.2.3