Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 248891f

Browse files
committed
Fix GUC's reports of assign_hook failure to always include the parameter value
we failed to assign, even in "can't happen" cases. Motivated by wondering what's going on in a recent trouble report where "failed to commit" did happen.
1 parent 24a814f commit 248891f

File tree

1 file changed

+23
-16
lines changed
  • src/backend/utils/misc

1 file changed

+23
-16
lines changed

src/backend/utils/misc/guc.c

+23-16
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.497 2009/03/09 14:34:34 petere Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.498 2009/04/02 03:51:43 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -3578,7 +3578,8 @@ ResetAllOptions(void)
35783578
if (conf->assign_hook)
35793579
if (!(*conf->assign_hook) (conf->reset_val, true,
35803580
PGC_S_SESSION))
3581-
elog(ERROR, "failed to reset %s", conf->gen.name);
3581+
elog(ERROR, "failed to reset %s to %d",
3582+
conf->gen.name, (int) conf->reset_val);
35823583
*conf->variable = conf->reset_val;
35833584
break;
35843585
}
@@ -3589,7 +3590,8 @@ ResetAllOptions(void)
35893590
if (conf->assign_hook)
35903591
if (!(*conf->assign_hook) (conf->reset_val, true,
35913592
PGC_S_SESSION))
3592-
elog(ERROR, "failed to reset %s", conf->gen.name);
3593+
elog(ERROR, "failed to reset %s to %d",
3594+
conf->gen.name, conf->reset_val);
35933595
*conf->variable = conf->reset_val;
35943596
break;
35953597
}
@@ -3600,7 +3602,8 @@ ResetAllOptions(void)
36003602
if (conf->assign_hook)
36013603
if (!(*conf->assign_hook) (conf->reset_val, true,
36023604
PGC_S_SESSION))
3603-
elog(ERROR, "failed to reset %s", conf->gen.name);
3605+
elog(ERROR, "failed to reset %s to %g",
3606+
conf->gen.name, conf->reset_val);
36043607
*conf->variable = conf->reset_val;
36053608
break;
36063609
}
@@ -3619,7 +3622,8 @@ ResetAllOptions(void)
36193622
newstr = (*conf->assign_hook) (str, true,
36203623
PGC_S_SESSION);
36213624
if (newstr == NULL)
3622-
elog(ERROR, "failed to reset %s", conf->gen.name);
3625+
elog(ERROR, "failed to reset %s to \"%s\"",
3626+
conf->gen.name, str);
36233627
else if (newstr != str)
36243628
{
36253629
/*
@@ -3639,7 +3643,9 @@ ResetAllOptions(void)
36393643
if (conf->assign_hook)
36403644
if (!(*conf->assign_hook) (conf->reset_val, true,
36413645
PGC_S_SESSION))
3642-
elog(ERROR, "failed to reset %s", conf->gen.name);
3646+
elog(ERROR, "failed to reset %s to %s",
3647+
conf->gen.name,
3648+
config_enum_lookup_by_value(conf, conf->reset_val));
36433649
*conf->variable = conf->reset_val;
36443650
break;
36453651
}
@@ -3910,8 +3916,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
39103916
if (conf->assign_hook)
39113917
if (!(*conf->assign_hook) (newval,
39123918
true, PGC_S_OVERRIDE))
3913-
elog(LOG, "failed to commit %s",
3914-
conf->gen.name);
3919+
elog(LOG, "failed to commit %s as %d",
3920+
conf->gen.name, (int) newval);
39153921
*conf->variable = newval;
39163922
changed = true;
39173923
}
@@ -3927,8 +3933,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
39273933
if (conf->assign_hook)
39283934
if (!(*conf->assign_hook) (newval,
39293935
true, PGC_S_OVERRIDE))
3930-
elog(LOG, "failed to commit %s",
3931-
conf->gen.name);
3936+
elog(LOG, "failed to commit %s as %d",
3937+
conf->gen.name, newval);
39323938
*conf->variable = newval;
39333939
changed = true;
39343940
}
@@ -3944,8 +3950,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
39443950
if (conf->assign_hook)
39453951
if (!(*conf->assign_hook) (newval,
39463952
true, PGC_S_OVERRIDE))
3947-
elog(LOG, "failed to commit %s",
3948-
conf->gen.name);
3953+
elog(LOG, "failed to commit %s as %g",
3954+
conf->gen.name, newval);
39493955
*conf->variable = newval;
39503956
changed = true;
39513957
}
@@ -3965,8 +3971,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
39653971
newstr = (*conf->assign_hook) (newval, true,
39663972
PGC_S_OVERRIDE);
39673973
if (newstr == NULL)
3968-
elog(LOG, "failed to commit %s",
3969-
conf->gen.name);
3974+
elog(LOG, "failed to commit %s as \"%s\"",
3975+
conf->gen.name, newval);
39703976
else if (newstr != newval)
39713977
{
39723978
/*
@@ -4004,8 +4010,9 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
40044010
if (conf->assign_hook)
40054011
if (!(*conf->assign_hook) (newval,
40064012
true, PGC_S_OVERRIDE))
4007-
elog(LOG, "failed to commit %s",
4008-
conf->gen.name);
4013+
elog(LOG, "failed to commit %s as %s",
4014+
conf->gen.name,
4015+
config_enum_lookup_by_value(conf, newval));
40094016
*conf->variable = newval;
40104017
changed = true;
40114018
}

0 commit comments

Comments
 (0)