summaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
authorPeter Eisentraut2016-11-12 17:00:00 +0000
committerPeter Eisentraut2017-03-06 18:31:47 +0000
commit8b6d6cf853aab12f0dc2adba7c99c3e458662734 (patch)
tree783806b4919b26f56dafde70e34bd6cd38bb261e /src/include/nodes
parent550214a4efb214dfc9c2a475607deeeea69da858 (diff)
Remove objname/objargs split for referring to objects
In simpler times, it might have worked to refer to all kinds of objects by a list of name components and an optional argument list. But this doesn't work for all objects, which has resulted in a collection of hacks to place various other nodes types into these fields, which have to be unpacked at the other end. This makes it also weird to represent lists of such things in the grammar, because they would have to be lists of singleton lists, to make the unpacking work consistently. The other problem is that keeping separate name and args fields makes it awkward to deal with lists of functions. Change that by dropping the objargs field and have objname, renamed to object, be a generic Node, which can then be flexibly assigned and managed using the normal Node mechanisms. In many cases it will still be a List of names, in some cases it will be a string Value, for types it will be the existing Typename, for functions it will now use the existing ObjectWithArgs node type. Some of the more obscure object types still use somewhat arbitrary nested lists. Reviewed-by: Jim Nasby <Jim.Nasby@BlueTreble.com> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/parsenodes.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 97993f51984..7c7530bd3f1 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2076,8 +2076,7 @@ typedef struct AlterExtensionContentsStmt
char *extname; /* Extension's name */
int action; /* +1 = add object, -1 = drop object */
ObjectType objtype; /* Object's type */
- List *objname; /* Qualified name of the object */
- List *objargs; /* Arguments if needed (eg, for functions) */
+ Node *object; /* Qualified name of the object */
} AlterExtensionContentsStmt;
/* ----------------------
@@ -2462,8 +2461,7 @@ typedef struct AlterOpFamilyStmt
typedef struct DropStmt
{
NodeTag type;
- List *objects; /* list of sublists of names (as Values) */
- List *arguments; /* list of sublists of arguments (as Values) */
+ List *objects; /* list of names */
ObjectType removeType; /* object type */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */
bool missing_ok; /* skip error if object is missing? */
@@ -2490,8 +2488,7 @@ typedef struct CommentStmt
{
NodeTag type;
ObjectType objtype; /* Object's type */
- List *objname; /* Qualified name of the object */
- List *objargs; /* Arguments if needed (eg, for functions) */
+ Node *object; /* Qualified name of the object */
char *comment; /* Comment to insert, or NULL to remove */
} CommentStmt;
@@ -2503,8 +2500,7 @@ typedef struct SecLabelStmt
{
NodeTag type;
ObjectType objtype; /* Object's type */
- List *objname; /* Qualified name of the object */
- List *objargs; /* Arguments if needed (eg, for functions) */
+ Node *object; /* Qualified name of the object */
char *provider; /* Label provider (or NULL) */
char *label; /* New security label to be assigned */
} SecLabelStmt;
@@ -2678,8 +2674,7 @@ typedef struct RenameStmt
ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
ObjectType relationType; /* if column name, associated relation type */
RangeVar *relation; /* in case it's a table */
- List *object; /* in case it's some other object */
- List *objarg; /* argument types, if applicable */
+ Node *object; /* in case it's some other object */
char *subname; /* name of contained object (column, rule,
* trigger, etc) */
char *newname; /* the new name */
@@ -2696,8 +2691,7 @@ typedef struct AlterObjectDependsStmt
NodeTag type;
ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
RangeVar *relation; /* in case a table is involved */
- List *objname; /* name of the object */
- List *objargs; /* argument types, if applicable */
+ Node *object; /* name of the object */
Value *extname; /* extension name */
} AlterObjectDependsStmt;
@@ -2710,8 +2704,7 @@ typedef struct AlterObjectSchemaStmt
NodeTag type;
ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
RangeVar *relation; /* in case it's a table */
- List *object; /* in case it's some other object */
- List *objarg; /* argument types, if applicable */
+ Node *object; /* in case it's some other object */
char *newschema; /* the new schema */
bool missing_ok; /* skip error if missing? */
} AlterObjectSchemaStmt;
@@ -2725,8 +2718,7 @@ typedef struct AlterOwnerStmt
NodeTag type;
ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
RangeVar *relation; /* in case it's a table */
- List *object; /* in case it's some other object */
- List *objarg; /* argument types, if applicable */
+ Node *object; /* in case it's some other object */
RoleSpec *newowner; /* the new owner */
} AlterOwnerStmt;