From 8b6d6cf853aab12f0dc2adba7c99c3e458662734 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 12 Nov 2016 12:00:00 -0500 Subject: 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 Reviewed-by: Michael Paquier --- src/backend/parser/parse_utilcmd.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/backend/parser/parse_utilcmd.c') diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index ff2bab65519..673276a9d3d 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -947,10 +947,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla CommentStmt *stmt = makeNode(CommentStmt); stmt->objtype = OBJECT_COLUMN; - stmt->objname = list_make3(makeString(cxt->relation->schemaname), - makeString(cxt->relation->relname), - makeString(def->colname)); - stmt->objargs = NIL; + stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname), + makeString(cxt->relation->relname), + makeString(def->colname)); stmt->comment = comment; cxt->alist = lappend(cxt->alist, stmt); @@ -1013,10 +1012,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla CommentStmt *stmt = makeNode(CommentStmt); stmt->objtype = OBJECT_TABCONSTRAINT; - stmt->objname = list_make3(makeString(cxt->relation->schemaname), - makeString(cxt->relation->relname), - makeString(n->conname)); - stmt->objargs = NIL; + stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname), + makeString(cxt->relation->relname), + makeString(n->conname)); stmt->comment = comment; cxt->alist = lappend(cxt->alist, stmt); -- cgit v1.2.3