Commit b120485f authored by Tom Lane's avatar Tom Lane

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.
parent 12a2121c
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.103 2004/08/31 19:28:51 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.104 2004/09/24 19:42:58 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -481,7 +481,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source) ...@@ -481,7 +481,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION), (errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query"))); errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query")));
else /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
else if (source != PGC_S_OVERRIDE)
return NULL; return NULL;
} }
if (IsSubTransaction()) if (IsSubTransaction())
...@@ -490,7 +491,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source) ...@@ -490,7 +491,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION), (errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
errmsg("SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction"))); errmsg("SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction")));
else /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
else if (source != PGC_S_OVERRIDE)
return NULL; return NULL;
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * 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) ...@@ -5532,7 +5532,8 @@ assign_stage_log_stats(bool newval, bool doit, GucSource source)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot enable parameter when \"log_statement_stats\" is true"))); 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 false;
} }
return true; return true;
...@@ -5550,7 +5551,8 @@ assign_log_stats(bool newval, bool doit, GucSource source) ...@@ -5550,7 +5551,8 @@ assign_log_stats(bool newval, bool doit, GucSource source)
errmsg("cannot enable \"log_statement_stats\" when " errmsg("cannot enable \"log_statement_stats\" when "
"\"log_parser_stats\", \"log_planner_stats\", " "\"log_parser_stats\", \"log_planner_stats\", "
"or \"log_executor_stats\" is true"))); "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 false;
} }
return true; return true;
...@@ -5566,6 +5568,8 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source) ...@@ -5566,6 +5568,8 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot set transaction read-write mode inside a read-only transaction"))); errmsg("cannot set transaction read-write mode inside a read-only transaction")));
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
else if (source != PGC_S_OVERRIDE)
return false; return false;
} }
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment