mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
Support SET FROM CURRENT in CREATE/ALTER FUNCTION, ALTER DATABASE, ALTER ROLE.
(Actually, it works as a plain statement too, but I didn't document that because it seems a bit useless.) Unify VariableResetStmt with VariableSetStmt, and clean up some ancient cruft in the representation of same.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.84 2007/09/03 00:39:15 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.85 2007/09/03 18:46:29 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* These routines take the parse tree and pick out the
|
||||
@@ -354,7 +354,7 @@ interpret_func_volatility(DefElem *defel)
|
||||
}
|
||||
|
||||
/*
|
||||
* Update a proconfig value according to a list of SET and RESET items.
|
||||
* Update a proconfig value according to a list of VariableSetStmt items.
|
||||
*
|
||||
* The input and result may be NULL to signify a null entry.
|
||||
*/
|
||||
@@ -365,33 +365,20 @@ update_proconfig_value(ArrayType *a, List *set_items)
|
||||
|
||||
foreach(l, set_items)
|
||||
{
|
||||
Node *sitem = (Node *) lfirst(l);
|
||||
VariableSetStmt *sstmt = (VariableSetStmt *) lfirst(l);
|
||||
|
||||
if (IsA(sitem, VariableSetStmt))
|
||||
Assert(IsA(sstmt, VariableSetStmt));
|
||||
if (sstmt->kind == VAR_RESET_ALL)
|
||||
a = NULL;
|
||||
else
|
||||
{
|
||||
VariableSetStmt *sstmt = (VariableSetStmt *) sitem;
|
||||
char *valuestr = ExtractSetVariableArgs(sstmt);
|
||||
|
||||
if (sstmt->args)
|
||||
{
|
||||
char *valuestr;
|
||||
|
||||
valuestr = flatten_set_variable_args(sstmt->name, sstmt->args);
|
||||
if (valuestr)
|
||||
a = GUCArrayAdd(a, sstmt->name, valuestr);
|
||||
}
|
||||
else /* SET TO DEFAULT */
|
||||
else /* RESET */
|
||||
a = GUCArrayDelete(a, sstmt->name);
|
||||
}
|
||||
else if (IsA(sitem, VariableResetStmt))
|
||||
{
|
||||
VariableResetStmt *rstmt = (VariableResetStmt *) sitem;
|
||||
|
||||
if (strcmp(rstmt->name, "all") == 0)
|
||||
a = NULL; /* RESET ALL */
|
||||
else
|
||||
a = GUCArrayDelete(a, rstmt->name);
|
||||
}
|
||||
else
|
||||
elog(ERROR, "unexpected node type: %d", nodeTag(sitem));
|
||||
}
|
||||
|
||||
return a;
|
||||
|
Reference in New Issue
Block a user