1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +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:
Tom Lane
2007-09-03 18:46:30 +00:00
parent dd4594e332
commit e7889b83b7
17 changed files with 382 additions and 360 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.352 2007/08/22 05:13:50 tgl Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.353 2007/09/03 18:46:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1050,6 +1050,42 @@ typedef struct CopyStmt
List *options; /* List of DefElem nodes */
} CopyStmt;
/* ----------------------
* SET Statement (includes RESET)
*
* "SET var TO DEFAULT" and "RESET var" are semantically equivalent, but we
* preserve the distinction in VariableSetKind for CreateCommandTag().
* ----------------------
*/
typedef enum
{
VAR_SET_VALUE, /* SET var = value */
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
VAR_SET_CURRENT, /* SET var FROM CURRENT */
VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
VAR_RESET, /* RESET var */
VAR_RESET_ALL /* RESET ALL */
} VariableSetKind;
typedef struct VariableSetStmt
{
NodeTag type;
VariableSetKind kind;
char *name; /* variable to be set */
List *args; /* List of A_Const nodes */
bool is_local; /* SET LOCAL? */
} VariableSetStmt;
/* ----------------------
* Show Statement
* ----------------------
*/
typedef struct VariableShowStmt
{
NodeTag type;
char *name;
} VariableShowStmt;
/* ----------------------
* Create Table Statement
*
@@ -1264,8 +1300,7 @@ typedef struct AlterRoleSetStmt
{
NodeTag type;
char *role; /* role name */
char *variable; /* GUC variable name */
List *value; /* value for variable, or NIL for Reset */
VariableSetStmt *setstmt; /* SET or RESET subcommand */
} AlterRoleSetStmt;
typedef struct DropRoleStmt
@@ -1781,9 +1816,8 @@ typedef struct AlterDatabaseStmt
typedef struct AlterDatabaseSetStmt
{
NodeTag type;
char *dbname;
char *variable;
List *value;
char *dbname; /* database name */
VariableSetStmt *setstmt; /* SET or RESET subcommand */
} AlterDatabaseSetStmt;
/* ----------------------
@@ -1848,41 +1882,6 @@ typedef struct CheckPointStmt
NodeTag type;
} CheckPointStmt;
/* ----------------------
* Set Statement
* ----------------------
*/
typedef struct VariableSetStmt
{
NodeTag type;
char *name;
List *args;
bool is_local; /* SET LOCAL */
} VariableSetStmt;
/* ----------------------
* Show Statement
* ----------------------
*/
typedef struct VariableShowStmt
{
NodeTag type;
char *name;
} VariableShowStmt;
/* ----------------------
* Reset Statement
* ----------------------
*/
typedef struct VariableResetStmt
{
NodeTag type;
char *name;
} VariableResetStmt;
/* ----------------------
* Discard Statement
* ----------------------