Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb120485

Browse files
committed
GUC assign hooks that look at external state in deciding whether a
setting is valid must ignore that state and permit the assignment anywaywhen source is PGC_S_OVERRIDE. Otherwise they may disallow a rollbackat transaction abort, which is The Wrong Thing. Per example fromMichael Fuhr 12-Sep-04.
1 parent12a2121 commitb120485

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

‎src/backend/commands/variable.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.103 2004/08/31 19:28:51 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.104 2004/09/24 19:42:58 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -481,7 +481,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source)
481481
ereport(ERROR,
482482
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
483483
errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query")));
484-
else
484+
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
485+
elseif (source!=PGC_S_OVERRIDE)
485486
returnNULL;
486487
}
487488
if (IsSubTransaction())
@@ -490,7 +491,8 @@ assign_XactIsoLevel(const char *value, bool doit, GucSource source)
490491
ereport(ERROR,
491492
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
492493
errmsg("SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction")));
493-
else
494+
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
495+
elseif (source!=PGC_S_OVERRIDE)
494496
returnNULL;
495497
}
496498

‎src/backend/utils/misc/guc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.238 2004/08/31 22:43:58 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.239 2004/09/24 19:43:03 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -5532,7 +5532,8 @@ assign_stage_log_stats(bool newval, bool doit, GucSource source)
55325532
ereport(ERROR,
55335533
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
55345534
errmsg("cannot enable parameter when \"log_statement_stats\" is true")));
5535-
else
5535+
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
5536+
elseif (source!=PGC_S_OVERRIDE)
55365537
return false;
55375538
}
55385539
return true;
@@ -5550,7 +5551,8 @@ assign_log_stats(bool newval, bool doit, GucSource source)
55505551
errmsg("cannot enable \"log_statement_stats\" when "
55515552
"\"log_parser_stats\", \"log_planner_stats\", "
55525553
"or \"log_executor_stats\" is true")));
5553-
else
5554+
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
5555+
elseif (source!=PGC_S_OVERRIDE)
55545556
return false;
55555557
}
55565558
return true;
@@ -5566,7 +5568,9 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source)
55665568
ereport(ERROR,
55675569
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
55685570
errmsg("cannot set transaction read-write mode inside a read-only transaction")));
5569-
return false;
5571+
/* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */
5572+
elseif (source!=PGC_S_OVERRIDE)
5573+
return false;
55705574
}
55715575
return true;
55725576
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp