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.
This commit is contained in:
parent
5dde1db4e1
commit
e7a4b97917
@ -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.432.2.2 2008/07/06 19:48:53 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.432.2.3 2009/04/02 03:51:50 tgl Exp $
|
||||||
*
|
*
|
||||||
*--------------------------------------------------------------------
|
*--------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -3327,7 +3327,8 @@ ResetAllOptions(void)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (conf->reset_val, true,
|
if (!(*conf->assign_hook) (conf->reset_val, true,
|
||||||
PGC_S_SESSION))
|
PGC_S_SESSION))
|
||||||
elog(ERROR, "failed to reset %s", conf->gen.name);
|
elog(ERROR, "failed to reset %s to %d",
|
||||||
|
conf->gen.name, (int) conf->reset_val);
|
||||||
*conf->variable = conf->reset_val;
|
*conf->variable = conf->reset_val;
|
||||||
conf->gen.source = conf->gen.reset_source;
|
conf->gen.source = conf->gen.reset_source;
|
||||||
break;
|
break;
|
||||||
@ -3339,7 +3340,8 @@ ResetAllOptions(void)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (conf->reset_val, true,
|
if (!(*conf->assign_hook) (conf->reset_val, true,
|
||||||
PGC_S_SESSION))
|
PGC_S_SESSION))
|
||||||
elog(ERROR, "failed to reset %s", conf->gen.name);
|
elog(ERROR, "failed to reset %s to %d",
|
||||||
|
conf->gen.name, conf->reset_val);
|
||||||
*conf->variable = conf->reset_val;
|
*conf->variable = conf->reset_val;
|
||||||
conf->gen.source = conf->gen.reset_source;
|
conf->gen.source = conf->gen.reset_source;
|
||||||
break;
|
break;
|
||||||
@ -3351,7 +3353,8 @@ ResetAllOptions(void)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (conf->reset_val, true,
|
if (!(*conf->assign_hook) (conf->reset_val, true,
|
||||||
PGC_S_SESSION))
|
PGC_S_SESSION))
|
||||||
elog(ERROR, "failed to reset %s", conf->gen.name);
|
elog(ERROR, "failed to reset %s to %g",
|
||||||
|
conf->gen.name, conf->reset_val);
|
||||||
*conf->variable = conf->reset_val;
|
*conf->variable = conf->reset_val;
|
||||||
conf->gen.source = conf->gen.reset_source;
|
conf->gen.source = conf->gen.reset_source;
|
||||||
break;
|
break;
|
||||||
@ -3371,7 +3374,8 @@ ResetAllOptions(void)
|
|||||||
newstr = (*conf->assign_hook) (str, true,
|
newstr = (*conf->assign_hook) (str, true,
|
||||||
PGC_S_SESSION);
|
PGC_S_SESSION);
|
||||||
if (newstr == NULL)
|
if (newstr == NULL)
|
||||||
elog(ERROR, "failed to reset %s", conf->gen.name);
|
elog(ERROR, "failed to reset %s to \"%s\"",
|
||||||
|
conf->gen.name, str);
|
||||||
else if (newstr != str)
|
else if (newstr != str)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -3650,8 +3654,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (newval,
|
if (!(*conf->assign_hook) (newval,
|
||||||
true, PGC_S_OVERRIDE))
|
true, PGC_S_OVERRIDE))
|
||||||
elog(LOG, "failed to commit %s",
|
elog(LOG, "failed to commit %s as %d",
|
||||||
conf->gen.name);
|
conf->gen.name, (int) newval);
|
||||||
*conf->variable = newval;
|
*conf->variable = newval;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -3667,8 +3671,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (newval,
|
if (!(*conf->assign_hook) (newval,
|
||||||
true, PGC_S_OVERRIDE))
|
true, PGC_S_OVERRIDE))
|
||||||
elog(LOG, "failed to commit %s",
|
elog(LOG, "failed to commit %s as %d",
|
||||||
conf->gen.name);
|
conf->gen.name, newval);
|
||||||
*conf->variable = newval;
|
*conf->variable = newval;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -3684,8 +3688,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
|
|||||||
if (conf->assign_hook)
|
if (conf->assign_hook)
|
||||||
if (!(*conf->assign_hook) (newval,
|
if (!(*conf->assign_hook) (newval,
|
||||||
true, PGC_S_OVERRIDE))
|
true, PGC_S_OVERRIDE))
|
||||||
elog(LOG, "failed to commit %s",
|
elog(LOG, "failed to commit %s as %g",
|
||||||
conf->gen.name);
|
conf->gen.name, newval);
|
||||||
*conf->variable = newval;
|
*conf->variable = newval;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -3705,8 +3709,8 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
|
|||||||
newstr = (*conf->assign_hook) (newval, true,
|
newstr = (*conf->assign_hook) (newval, true,
|
||||||
PGC_S_OVERRIDE);
|
PGC_S_OVERRIDE);
|
||||||
if (newstr == NULL)
|
if (newstr == NULL)
|
||||||
elog(LOG, "failed to commit %s",
|
elog(LOG, "failed to commit %s as \"%s\"",
|
||||||
conf->gen.name);
|
conf->gen.name, newval);
|
||||||
else if (newstr != newval)
|
else if (newstr != newval)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user