Commit 8b6d6cf8 authored by Peter Eisentraut's avatar Peter Eisentraut

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: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent 550214a4
...@@ -707,31 +707,31 @@ const ObjectAddress InvalidObjectAddress = ...@@ -707,31 +707,31 @@ const ObjectAddress InvalidObjectAddress =
}; };
static ObjectAddress get_object_address_unqualified(ObjectType objtype, static ObjectAddress get_object_address_unqualified(ObjectType objtype,
List *qualname, bool missing_ok); Value *strval, bool missing_ok);
static ObjectAddress get_relation_by_qualified_name(ObjectType objtype, static ObjectAddress get_relation_by_qualified_name(ObjectType objtype,
List *objname, Relation *relp, List *object, Relation *relp,
LOCKMODE lockmode, bool missing_ok); LOCKMODE lockmode, bool missing_ok);
static ObjectAddress get_object_address_relobject(ObjectType objtype, static ObjectAddress get_object_address_relobject(ObjectType objtype,
List *objname, Relation *relp, bool missing_ok); List *object, Relation *relp, bool missing_ok);
static ObjectAddress get_object_address_attribute(ObjectType objtype, static ObjectAddress get_object_address_attribute(ObjectType objtype,
List *objname, Relation *relp, List *object, Relation *relp,
LOCKMODE lockmode, bool missing_ok); LOCKMODE lockmode, bool missing_ok);
static ObjectAddress get_object_address_attrdef(ObjectType objtype, static ObjectAddress get_object_address_attrdef(ObjectType objtype,
List *objname, Relation *relp, LOCKMODE lockmode, List *object, Relation *relp, LOCKMODE lockmode,
bool missing_ok); bool missing_ok);
static ObjectAddress get_object_address_type(ObjectType objtype, static ObjectAddress get_object_address_type(ObjectType objtype,
ListCell *typecell, bool missing_ok); TypeName *typename, bool missing_ok);
static ObjectAddress get_object_address_opcf(ObjectType objtype, List *objname, static ObjectAddress get_object_address_opcf(ObjectType objtype, List *object,
bool missing_ok); bool missing_ok);
static ObjectAddress get_object_address_opf_member(ObjectType objtype, static ObjectAddress get_object_address_opf_member(ObjectType objtype,
List *objname, List *objargs, bool missing_ok); List *object, bool missing_ok);
static ObjectAddress get_object_address_usermapping(List *objname, static ObjectAddress get_object_address_usermapping(List *object,
List *objargs, bool missing_ok); bool missing_ok);
static ObjectAddress get_object_address_publication_rel(List *objname, static ObjectAddress get_object_address_publication_rel(List *object,
List *objargs, Relation *relp, Relation *relp,
bool missing_ok); bool missing_ok);
static ObjectAddress get_object_address_defacl(List *objname, List *objargs, static ObjectAddress get_object_address_defacl(List *object,
bool missing_ok); bool missing_ok);
static const ObjectPropertyType *get_object_property_data(Oid class_id); static const ObjectPropertyType *get_object_property_data(Oid class_id);
...@@ -741,8 +741,8 @@ static void getRelationTypeDescription(StringInfo buffer, Oid relid, ...@@ -741,8 +741,8 @@ static void getRelationTypeDescription(StringInfo buffer, Oid relid,
int32 objectSubId); int32 objectSubId);
static void getProcedureTypeDescription(StringInfo buffer, Oid procid); static void getProcedureTypeDescription(StringInfo buffer, Oid procid);
static void getConstraintTypeDescription(StringInfo buffer, Oid constroid); static void getConstraintTypeDescription(StringInfo buffer, Oid constroid);
static void getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname); static void getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **object);
static void getRelationIdentity(StringInfo buffer, Oid relid, List **objname); static void getRelationIdentity(StringInfo buffer, Oid relid, List **object);
/* /*
* Translate an object name and arguments (as passed by the parser) to an * Translate an object name and arguments (as passed by the parser) to an
...@@ -776,7 +776,7 @@ static void getRelationIdentity(StringInfo buffer, Oid relid, List **objname); ...@@ -776,7 +776,7 @@ static void getRelationIdentity(StringInfo buffer, Oid relid, List **objname);
* better to add some support for that in this function. * better to add some support for that in this function.
*/ */
ObjectAddress ObjectAddress
get_object_address(ObjectType objtype, List *objname, List *objargs, get_object_address(ObjectType objtype, Node *object,
Relation *relp, LOCKMODE lockmode, bool missing_ok) Relation *relp, LOCKMODE lockmode, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
...@@ -806,19 +806,19 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -806,19 +806,19 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
case OBJECT_MATVIEW: case OBJECT_MATVIEW:
case OBJECT_FOREIGN_TABLE: case OBJECT_FOREIGN_TABLE:
address = address =
get_relation_by_qualified_name(objtype, objname, get_relation_by_qualified_name(objtype, castNode(List, object),
&relation, lockmode, &relation, lockmode,
missing_ok); missing_ok);
break; break;
case OBJECT_COLUMN: case OBJECT_COLUMN:
address = address =
get_object_address_attribute(objtype, objname, get_object_address_attribute(objtype, castNode(List, object),
&relation, lockmode, &relation, lockmode,
missing_ok); missing_ok);
break; break;
case OBJECT_DEFAULT: case OBJECT_DEFAULT:
address = address =
get_object_address_attrdef(objtype, objname, get_object_address_attrdef(objtype, castNode(List, object),
&relation, lockmode, &relation, lockmode,
missing_ok); missing_ok);
break; break;
...@@ -826,17 +826,20 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -826,17 +826,20 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
case OBJECT_TRIGGER: case OBJECT_TRIGGER:
case OBJECT_TABCONSTRAINT: case OBJECT_TABCONSTRAINT:
case OBJECT_POLICY: case OBJECT_POLICY:
address = get_object_address_relobject(objtype, objname, address = get_object_address_relobject(objtype, castNode(List, object),
&relation, missing_ok); &relation, missing_ok);
break; break;
case OBJECT_DOMCONSTRAINT: case OBJECT_DOMCONSTRAINT:
{ {
List *objlist;
ObjectAddress domaddr; ObjectAddress domaddr;
char *constrname; char *constrname;
objlist = castNode(List, object);
domaddr = get_object_address_type(OBJECT_DOMAIN, domaddr = get_object_address_type(OBJECT_DOMAIN,
list_head(objname), missing_ok); castNode(TypeName, linitial(objlist)),
constrname = strVal(linitial(objargs)); missing_ok);
constrname = strVal(lsecond(objlist));
address.classId = ConstraintRelationId; address.classId = ConstraintRelationId;
address.objectId = get_domain_constraint_oid(domaddr.objectId, address.objectId = get_domain_constraint_oid(domaddr.objectId,
...@@ -858,57 +861,64 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -858,57 +861,64 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
case OBJECT_PUBLICATION: case OBJECT_PUBLICATION:
case OBJECT_SUBSCRIPTION: case OBJECT_SUBSCRIPTION:
address = get_object_address_unqualified(objtype, address = get_object_address_unqualified(objtype,
objname, missing_ok); (Value *) object, missing_ok);
break; break;
case OBJECT_TYPE: case OBJECT_TYPE:
case OBJECT_DOMAIN: case OBJECT_DOMAIN:
address = get_object_address_type(objtype, list_head(objname), missing_ok); address = get_object_address_type(objtype, castNode(TypeName, object), missing_ok);
break; break;
case OBJECT_AGGREGATE: case OBJECT_AGGREGATE:
address.classId = ProcedureRelationId; {
address.objectId = ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
LookupAggNameTypeNames(objname, objargs, missing_ok); address.classId = ProcedureRelationId;
address.objectSubId = 0; address.objectId =
break; LookupAggNameTypeNames(owa->objname, owa->objargs, missing_ok);
address.objectSubId = 0;
break;
}
case OBJECT_FUNCTION: case OBJECT_FUNCTION:
address.classId = ProcedureRelationId; {
address.objectId = ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
LookupFuncNameTypeNames(objname, objargs, missing_ok); address.classId = ProcedureRelationId;
address.objectSubId = 0; address.objectId =
break; LookupFuncNameTypeNames(owa->objname, owa->objargs, missing_ok);
address.objectSubId = 0;
break;
}
case OBJECT_OPERATOR: case OBJECT_OPERATOR:
Assert(list_length(objargs) == 2); {
address.classId = OperatorRelationId; ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
address.objectId = address.classId = OperatorRelationId;
LookupOperNameTypeNames(NULL, objname, Assert(list_length(owa->objargs) == 2);
(TypeName *) linitial(objargs), address.objectId =
(TypeName *) lsecond(objargs), LookupOperNameTypeNames(NULL, owa->objname,
missing_ok, -1); castNode(TypeName, linitial(owa->objargs)),
address.objectSubId = 0; castNode(TypeName, lsecond(owa->objargs)),
break; missing_ok, -1);
address.objectSubId = 0;
break;
}
case OBJECT_COLLATION: case OBJECT_COLLATION:
address.classId = CollationRelationId; address.classId = CollationRelationId;
address.objectId = get_collation_oid(objname, missing_ok); address.objectId = get_collation_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_CONVERSION: case OBJECT_CONVERSION:
address.classId = ConversionRelationId; address.classId = ConversionRelationId;
address.objectId = get_conversion_oid(objname, missing_ok); address.objectId = get_conversion_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_OPCLASS: case OBJECT_OPCLASS:
case OBJECT_OPFAMILY: case OBJECT_OPFAMILY:
address = get_object_address_opcf(objtype, objname, missing_ok); address = get_object_address_opcf(objtype, castNode(List, object), missing_ok);
break; break;
case OBJECT_AMOP: case OBJECT_AMOP:
case OBJECT_AMPROC: case OBJECT_AMPROC:
address = get_object_address_opf_member(objtype, objname, address = get_object_address_opf_member(objtype, castNode(List, object), missing_ok);
objargs, missing_ok);
break; break;
case OBJECT_LARGEOBJECT: case OBJECT_LARGEOBJECT:
Assert(list_length(objname) == 1);
address.classId = LargeObjectRelationId; address.classId = LargeObjectRelationId;
address.objectId = oidparse(linitial(objname)); address.objectId = oidparse(object);
address.objectSubId = 0; address.objectSubId = 0;
if (!LargeObjectExists(address.objectId)) if (!LargeObjectExists(address.objectId))
{ {
...@@ -921,8 +931,8 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -921,8 +931,8 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
break; break;
case OBJECT_CAST: case OBJECT_CAST:
{ {
TypeName *sourcetype = (TypeName *) linitial(objname); TypeName *sourcetype = castNode(TypeName, linitial(castNode(List, object)));
TypeName *targettype = (TypeName *) linitial(objargs); TypeName *targettype = castNode(TypeName, lsecond(castNode(List, object)));
Oid sourcetypeid; Oid sourcetypeid;
Oid targettypeid; Oid targettypeid;
...@@ -936,8 +946,8 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -936,8 +946,8 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
break; break;
case OBJECT_TRANSFORM: case OBJECT_TRANSFORM:
{ {
TypeName *typename = (TypeName *) linitial(objname); TypeName *typename = castNode(TypeName, linitial(castNode(List, object)));
char *langname = strVal(linitial(objargs)); char *langname = strVal(lsecond(castNode(List, object)));
Oid type_id = LookupTypeNameOid(NULL, typename, missing_ok); Oid type_id = LookupTypeNameOid(NULL, typename, missing_ok);
Oid lang_id = get_language_oid(langname, missing_ok); Oid lang_id = get_language_oid(langname, missing_ok);
...@@ -949,35 +959,35 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -949,35 +959,35 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
break; break;
case OBJECT_TSPARSER: case OBJECT_TSPARSER:
address.classId = TSParserRelationId; address.classId = TSParserRelationId;
address.objectId = get_ts_parser_oid(objname, missing_ok); address.objectId = get_ts_parser_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_TSDICTIONARY: case OBJECT_TSDICTIONARY:
address.classId = TSDictionaryRelationId; address.classId = TSDictionaryRelationId;
address.objectId = get_ts_dict_oid(objname, missing_ok); address.objectId = get_ts_dict_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_TSTEMPLATE: case OBJECT_TSTEMPLATE:
address.classId = TSTemplateRelationId; address.classId = TSTemplateRelationId;
address.objectId = get_ts_template_oid(objname, missing_ok); address.objectId = get_ts_template_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_TSCONFIGURATION: case OBJECT_TSCONFIGURATION:
address.classId = TSConfigRelationId; address.classId = TSConfigRelationId;
address.objectId = get_ts_config_oid(objname, missing_ok); address.objectId = get_ts_config_oid(castNode(List, object), missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_USER_MAPPING: case OBJECT_USER_MAPPING:
address = get_object_address_usermapping(objname, objargs, address = get_object_address_usermapping(castNode(List, object),
missing_ok); missing_ok);
break; break;
case OBJECT_PUBLICATION_REL: case OBJECT_PUBLICATION_REL:
address = get_object_address_publication_rel(objname, objargs, address = get_object_address_publication_rel(castNode(List, object),
&relation, &relation,
missing_ok); missing_ok);
break; break;
case OBJECT_DEFACL: case OBJECT_DEFACL:
address = get_object_address_defacl(objname, objargs, address = get_object_address_defacl(castNode(List, object),
missing_ok); missing_ok);
break; break;
default: default:
...@@ -1068,25 +1078,25 @@ get_object_address(ObjectType objtype, List *objname, List *objargs, ...@@ -1068,25 +1078,25 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
/* /*
* Return an ObjectAddress based on a RangeVar and an object name. The * Return an ObjectAddress based on a RangeVar and an object name. The
* name of the relation identified by the RangeVar is prepended to the * name of the relation identified by the RangeVar is prepended to the
* (possibly empty) list passed in as objname. This is useful to find * (possibly empty) list passed in as object. This is useful to find
* the ObjectAddress of objects that depend on a relation. All other * the ObjectAddress of objects that depend on a relation. All other
* considerations are exactly as for get_object_address above. * considerations are exactly as for get_object_address above.
*/ */
ObjectAddress ObjectAddress
get_object_address_rv(ObjectType objtype, RangeVar *rel, List *objname, get_object_address_rv(ObjectType objtype, RangeVar *rel, List *object,
List *objargs, Relation *relp, LOCKMODE lockmode, Relation *relp, LOCKMODE lockmode,
bool missing_ok) bool missing_ok)
{ {
if (rel) if (rel)
{ {
objname = lcons(makeString(rel->relname), objname); object = lcons(makeString(rel->relname), object);
if (rel->schemaname) if (rel->schemaname)
objname = lcons(makeString(rel->schemaname), objname); object = lcons(makeString(rel->schemaname), object);
if (rel->catalogname) if (rel->catalogname)
objname = lcons(makeString(rel->catalogname), objname); object = lcons(makeString(rel->catalogname), object);
} }
return get_object_address(objtype, objname, objargs, return get_object_address(objtype, (Node *) object,
relp, lockmode, missing_ok); relp, lockmode, missing_ok);
} }
...@@ -1096,68 +1106,12 @@ get_object_address_rv(ObjectType objtype, RangeVar *rel, List *objname, ...@@ -1096,68 +1106,12 @@ get_object_address_rv(ObjectType objtype, RangeVar *rel, List *objname,
*/ */
static ObjectAddress static ObjectAddress
get_object_address_unqualified(ObjectType objtype, get_object_address_unqualified(ObjectType objtype,
List *qualname, bool missing_ok) Value *strval, bool missing_ok)
{ {
const char *name; const char *name;
ObjectAddress address; ObjectAddress address;
/* name = strVal(strval);
* The types of names handled by this function are not permitted to be
* schema-qualified or catalog-qualified.
*/
if (list_length(qualname) != 1)
{
const char *msg;
switch (objtype)
{
case OBJECT_ACCESS_METHOD:
msg = gettext_noop("access method name cannot be qualified");
break;
case OBJECT_DATABASE:
msg = gettext_noop("database name cannot be qualified");
break;
case OBJECT_EXTENSION:
msg = gettext_noop("extension name cannot be qualified");
break;
case OBJECT_TABLESPACE:
msg = gettext_noop("tablespace name cannot be qualified");
break;
case OBJECT_ROLE:
msg = gettext_noop("role name cannot be qualified");
break;
case OBJECT_SCHEMA:
msg = gettext_noop("schema name cannot be qualified");
break;
case OBJECT_LANGUAGE:
msg = gettext_noop("language name cannot be qualified");
break;
case OBJECT_FDW:
msg = gettext_noop("foreign-data wrapper name cannot be qualified");
break;
case OBJECT_FOREIGN_SERVER:
msg = gettext_noop("server name cannot be qualified");
break;
case OBJECT_EVENT_TRIGGER:
msg = gettext_noop("event trigger name cannot be qualified");
break;
case OBJECT_PUBLICATION:
msg = gettext_noop("publication name cannot be qualified");
break;
case OBJECT_SUBSCRIPTION:
msg = gettext_noop("subscription name cannot be qualified");
break;
default:
elog(ERROR, "unrecognized objtype: %d", (int) objtype);
msg = NULL; /* placate compiler */
}
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s", _(msg))));
}
/* Format is valid, extract the actual name. */
name = strVal(linitial(qualname));
/* Translate name to OID. */ /* Translate name to OID. */
switch (objtype) switch (objtype)
...@@ -1237,7 +1191,7 @@ get_object_address_unqualified(ObjectType objtype, ...@@ -1237,7 +1191,7 @@ get_object_address_unqualified(ObjectType objtype,
* Locate a relation by qualified name. * Locate a relation by qualified name.
*/ */
static ObjectAddress static ObjectAddress
get_relation_by_qualified_name(ObjectType objtype, List *objname, get_relation_by_qualified_name(ObjectType objtype, List *object,
Relation *relp, LOCKMODE lockmode, Relation *relp, LOCKMODE lockmode,
bool missing_ok) bool missing_ok)
{ {
...@@ -1248,7 +1202,7 @@ get_relation_by_qualified_name(ObjectType objtype, List *objname, ...@@ -1248,7 +1202,7 @@ get_relation_by_qualified_name(ObjectType objtype, List *objname,
address.objectId = InvalidOid; address.objectId = InvalidOid;
address.objectSubId = 0; address.objectSubId = 0;
relation = relation_openrv_extended(makeRangeVarFromNameList(objname), relation = relation_openrv_extended(makeRangeVarFromNameList(object),
lockmode, missing_ok); lockmode, missing_ok);
if (!relation) if (!relation)
return address; return address;
...@@ -1318,7 +1272,7 @@ get_relation_by_qualified_name(ObjectType objtype, List *objname, ...@@ -1318,7 +1272,7 @@ get_relation_by_qualified_name(ObjectType objtype, List *objname,
* mode for the object itself, not the relation to which it is attached. * mode for the object itself, not the relation to which it is attached.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_relobject(ObjectType objtype, List *objname, get_object_address_relobject(ObjectType objtype, List *object,
Relation *relp, bool missing_ok) Relation *relp, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
...@@ -1329,17 +1283,17 @@ get_object_address_relobject(ObjectType objtype, List *objname, ...@@ -1329,17 +1283,17 @@ get_object_address_relobject(ObjectType objtype, List *objname,
Oid reloid; Oid reloid;
/* Extract name of dependent object. */ /* Extract name of dependent object. */
depname = strVal(llast(objname)); depname = strVal(llast(object));
/* Separate relation name from dependent object name. */ /* Separate relation name from dependent object name. */
nnames = list_length(objname); nnames = list_length(object);
if (nnames < 2) if (nnames < 2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("must specify relation and object name"))); errmsg("must specify relation and object name")));
/* Extract relation name and open relation. */ /* Extract relation name and open relation. */
relname = list_truncate(list_copy(objname), nnames - 1); relname = list_truncate(list_copy(object), nnames - 1);
relation = heap_openrv_extended(makeRangeVarFromNameList(relname), relation = heap_openrv_extended(makeRangeVarFromNameList(relname),
AccessShareLock, AccessShareLock,
missing_ok); missing_ok);
...@@ -1397,7 +1351,7 @@ get_object_address_relobject(ObjectType objtype, List *objname, ...@@ -1397,7 +1351,7 @@ get_object_address_relobject(ObjectType objtype, List *objname,
* Find the ObjectAddress for an attribute. * Find the ObjectAddress for an attribute.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_attribute(ObjectType objtype, List *objname, get_object_address_attribute(ObjectType objtype, List *object,
Relation *relp, LOCKMODE lockmode, Relation *relp, LOCKMODE lockmode,
bool missing_ok) bool missing_ok)
{ {
...@@ -1409,12 +1363,12 @@ get_object_address_attribute(ObjectType objtype, List *objname, ...@@ -1409,12 +1363,12 @@ get_object_address_attribute(ObjectType objtype, List *objname,
AttrNumber attnum; AttrNumber attnum;
/* Extract relation name and open relation. */ /* Extract relation name and open relation. */
if (list_length(objname) < 2) if (list_length(object) < 2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("column name must be qualified"))); errmsg("column name must be qualified")));
attname = strVal(lfirst(list_tail(objname))); attname = strVal(lfirst(list_tail(object)));
relname = list_truncate(list_copy(objname), list_length(objname) - 1); relname = list_truncate(list_copy(object), list_length(object) - 1);
/* XXX no missing_ok support here */ /* XXX no missing_ok support here */
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode); relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
reloid = RelationGetRelid(relation); reloid = RelationGetRelid(relation);
...@@ -1448,7 +1402,7 @@ get_object_address_attribute(ObjectType objtype, List *objname, ...@@ -1448,7 +1402,7 @@ get_object_address_attribute(ObjectType objtype, List *objname,
* Find the ObjectAddress for an attribute's default value. * Find the ObjectAddress for an attribute's default value.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_attrdef(ObjectType objtype, List *objname, get_object_address_attrdef(ObjectType objtype, List *object,
Relation *relp, LOCKMODE lockmode, Relation *relp, LOCKMODE lockmode,
bool missing_ok) bool missing_ok)
{ {
...@@ -1462,12 +1416,12 @@ get_object_address_attrdef(ObjectType objtype, List *objname, ...@@ -1462,12 +1416,12 @@ get_object_address_attrdef(ObjectType objtype, List *objname,
Oid defoid; Oid defoid;
/* Extract relation name and open relation. */ /* Extract relation name and open relation. */
if (list_length(objname) < 2) if (list_length(object) < 2)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR), (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("column name must be qualified"))); errmsg("column name must be qualified")));
attname = strVal(llast(objname)); attname = strVal(llast(object));
relname = list_truncate(list_copy(objname), list_length(objname) - 1); relname = list_truncate(list_copy(object), list_length(object) - 1);
/* XXX no missing_ok support here */ /* XXX no missing_ok support here */
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode); relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
reloid = RelationGetRelid(relation); reloid = RelationGetRelid(relation);
...@@ -1530,14 +1484,11 @@ get_object_address_attrdef(ObjectType objtype, List *objname, ...@@ -1530,14 +1484,11 @@ get_object_address_attrdef(ObjectType objtype, List *objname,
* Find the ObjectAddress for a type or domain * Find the ObjectAddress for a type or domain
*/ */
static ObjectAddress static ObjectAddress
get_object_address_type(ObjectType objtype, ListCell *typecell, bool missing_ok) get_object_address_type(ObjectType objtype, TypeName *typename, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
TypeName *typename;
Type tup; Type tup;
typename = (TypeName *) lfirst(typecell);
address.classId = TypeRelationId; address.classId = TypeRelationId;
address.objectId = InvalidOid; address.objectId = InvalidOid;
address.objectSubId = 0; address.objectSubId = 0;
...@@ -1572,25 +1523,25 @@ get_object_address_type(ObjectType objtype, ListCell *typecell, bool missing_ok) ...@@ -1572,25 +1523,25 @@ get_object_address_type(ObjectType objtype, ListCell *typecell, bool missing_ok)
* Find the ObjectAddress for an opclass or opfamily. * Find the ObjectAddress for an opclass or opfamily.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_opcf(ObjectType objtype, List *objname, bool missing_ok) get_object_address_opcf(ObjectType objtype, List *object, bool missing_ok)
{ {
Oid amoid; Oid amoid;
ObjectAddress address; ObjectAddress address;
/* XXX no missing_ok support here */ /* XXX no missing_ok support here */
amoid = get_index_am_oid(strVal(linitial(objname)), false); amoid = get_index_am_oid(strVal(linitial(object)), false);
objname = list_copy_tail(objname, 1); object = list_copy_tail(object, 1);
switch (objtype) switch (objtype)
{ {
case OBJECT_OPCLASS: case OBJECT_OPCLASS:
address.classId = OperatorClassRelationId; address.classId = OperatorClassRelationId;
address.objectId = get_opclass_oid(amoid, objname, missing_ok); address.objectId = get_opclass_oid(amoid, object, missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
case OBJECT_OPFAMILY: case OBJECT_OPFAMILY:
address.classId = OperatorFamilyRelationId; address.classId = OperatorFamilyRelationId;
address.objectId = get_opfamily_oid(amoid, objname, missing_ok); address.objectId = get_opfamily_oid(amoid, object, missing_ok);
address.objectSubId = 0; address.objectSubId = 0;
break; break;
default: default:
...@@ -1611,7 +1562,7 @@ get_object_address_opcf(ObjectType objtype, List *objname, bool missing_ok) ...@@ -1611,7 +1562,7 @@ get_object_address_opcf(ObjectType objtype, List *objname, bool missing_ok)
*/ */
static ObjectAddress static ObjectAddress
get_object_address_opf_member(ObjectType objtype, get_object_address_opf_member(ObjectType objtype,
List *objname, List *objargs, bool missing_ok) List *object, bool missing_ok)
{ {
ObjectAddress famaddr; ObjectAddress famaddr;
ObjectAddress address; ObjectAddress address;
...@@ -1623,24 +1574,24 @@ get_object_address_opf_member(ObjectType objtype, ...@@ -1623,24 +1574,24 @@ get_object_address_opf_member(ObjectType objtype,
int i; int i;
/* /*
* The last element of the objname list contains the strategy or procedure * The last element of the object list contains the strategy or procedure
* number. We need to strip that out before getting the opclass/family * number. We need to strip that out before getting the opclass/family
* address. The rest can be used directly by get_object_address_opcf(). * address. The rest can be used directly by get_object_address_opcf().
*/ */
membernum = atoi(strVal(llast(objname))); membernum = atoi(strVal(llast(linitial(object))));
copy = list_truncate(list_copy(objname), list_length(objname) - 1); copy = list_truncate(list_copy(linitial(object)), list_length(linitial(object)) - 1);
/* no missing_ok support here */ /* no missing_ok support here */
famaddr = get_object_address_opcf(OBJECT_OPFAMILY, copy, false); famaddr = get_object_address_opcf(OBJECT_OPFAMILY, copy, false);
/* find out left/right type names and OIDs */ /* find out left/right type names and OIDs */
i = 0; i = 0;
foreach(cell, objargs) foreach(cell, lsecond(object))
{ {
ObjectAddress typaddr; ObjectAddress typaddr;
typenames[i] = strVal(lfirst(cell)); typenames[i] = strVal(lfirst(cell));
typaddr = get_object_address_type(OBJECT_TYPE, cell, missing_ok); typaddr = get_object_address_type(OBJECT_TYPE, castNode(TypeName, lfirst(cell)), missing_ok);
typeoids[i] = typaddr.objectId; typeoids[i] = typaddr.objectId;
if (++i >= 2) if (++i >= 2)
break; break;
...@@ -1716,7 +1667,7 @@ get_object_address_opf_member(ObjectType objtype, ...@@ -1716,7 +1667,7 @@ get_object_address_opf_member(ObjectType objtype,
* Find the ObjectAddress for a user mapping. * Find the ObjectAddress for a user mapping.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_usermapping(List *objname, List *objargs, bool missing_ok) get_object_address_usermapping(List *object, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
Oid userid; Oid userid;
...@@ -1728,8 +1679,8 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok) ...@@ -1728,8 +1679,8 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
ObjectAddressSet(address, UserMappingRelationId, InvalidOid); ObjectAddressSet(address, UserMappingRelationId, InvalidOid);
/* fetch string names from input lists, for error messages */ /* fetch string names from input lists, for error messages */
username = strVal(linitial(objname)); username = strVal(linitial(object));
servername = strVal(linitial(objargs)); servername = strVal(lsecond(object));
/* look up pg_authid OID of mapped user; InvalidOid if PUBLIC */ /* look up pg_authid OID of mapped user; InvalidOid if PUBLIC */
if (strcmp(username, "public") == 0) if (strcmp(username, "public") == 0)
...@@ -1782,27 +1733,30 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok) ...@@ -1782,27 +1733,30 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
} }
/* /*
* Find the ObjectAddress for a publication relation. The objname parameter * Find the ObjectAddress for a publication relation. The first element of
* is the relation name; objargs contains the publication name. * the object parameter is the relation name, the second is the
* publication name.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_publication_rel(List *objname, List *objargs, get_object_address_publication_rel(List *object,
Relation *relp, bool missing_ok) Relation *relp, bool missing_ok)
{ {
ObjectAddress address; ObjectAddress address;
Relation relation; Relation relation;
List *relname;
char *pubname; char *pubname;
Publication *pub; Publication *pub;
ObjectAddressSet(address, PublicationRelRelationId, InvalidOid); ObjectAddressSet(address, PublicationRelRelationId, InvalidOid);
relation = relation_openrv_extended(makeRangeVarFromNameList(objname), relname = linitial(object);
relation = relation_openrv_extended(makeRangeVarFromNameList(relname),
AccessShareLock, missing_ok); AccessShareLock, missing_ok);
if (!relation) if (!relation)
return address; return address;
/* fetch publication name from input list */ /* fetch publication name from input list */
pubname = strVal(linitial(objargs)); pubname = strVal(lsecond(object));
/* Now look up the pg_publication tuple */ /* Now look up the pg_publication tuple */
pub = GetPublicationByName(pubname, missing_ok); pub = GetPublicationByName(pubname, missing_ok);
...@@ -1836,7 +1790,7 @@ get_object_address_publication_rel(List *objname, List *objargs, ...@@ -1836,7 +1790,7 @@ get_object_address_publication_rel(List *objname, List *objargs,
* Find the ObjectAddress for a default ACL. * Find the ObjectAddress for a default ACL.
*/ */
static ObjectAddress static ObjectAddress
get_object_address_defacl(List *objname, List *objargs, bool missing_ok) get_object_address_defacl(List *object, bool missing_ok)
{ {
HeapTuple tp; HeapTuple tp;
Oid userid; Oid userid;
...@@ -1853,9 +1807,9 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok) ...@@ -1853,9 +1807,9 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok)
* First figure out the textual attributes so that they can be used for * First figure out the textual attributes so that they can be used for
* error reporting. * error reporting.
*/ */
username = strVal(linitial(objname)); username = strVal(lsecond(object));
if (list_length(objname) >= 2) if (list_length(object) >= 3)
schema = (char *) strVal(lsecond(objname)); schema = (char *) strVal(lthird(object));
else else
schema = NULL; schema = NULL;
...@@ -1863,7 +1817,7 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok) ...@@ -1863,7 +1817,7 @@ get_object_address_defacl(List *objname, List *objargs, bool missing_ok)
* Decode defaclobjtype. Only first char is considered; the rest of the * Decode defaclobjtype. Only first char is considered; the rest of the
* string, if any, is blissfully ignored. * string, if any, is blissfully ignored.
*/ */
objtype = ((char *) strVal(linitial(objargs)))[0]; objtype = ((char *) strVal(linitial(object)))[0];
switch (objtype) switch (objtype)
{ {
case DEFACLOBJ_RELATION: case DEFACLOBJ_RELATION:
...@@ -1978,8 +1932,10 @@ pg_get_object_address(PG_FUNCTION_ARGS) ...@@ -1978,8 +1932,10 @@ pg_get_object_address(PG_FUNCTION_ARGS)
ArrayType *argsarr = PG_GETARG_ARRAYTYPE_P(2); ArrayType *argsarr = PG_GETARG_ARRAYTYPE_P(2);
int itype; int itype;
ObjectType type; ObjectType type;
List *name; List *name = NIL;
List *args; TypeName *typename = NULL;
List *args = NIL;
Node *objnode = NULL;
ObjectAddress addr; ObjectAddress addr;
TupleDesc tupdesc; TupleDesc tupdesc;
Datum values[3]; Datum values[3];
...@@ -2017,7 +1973,7 @@ pg_get_object_address(PG_FUNCTION_ARGS) ...@@ -2017,7 +1973,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("name or argument lists may not contain nulls"))); errmsg("name or argument lists may not contain nulls")));
name = list_make1(typeStringToTypeName(TextDatumGetCString(elems[0]))); typename = typeStringToTypeName(TextDatumGetCString(elems[0]));
} }
else if (type == OBJECT_LARGEOBJECT) else if (type == OBJECT_LARGEOBJECT)
{ {
...@@ -2035,7 +1991,7 @@ pg_get_object_address(PG_FUNCTION_ARGS) ...@@ -2035,7 +1991,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("large object OID may not be null"))); errmsg("large object OID may not be null")));
name = list_make1(makeFloat(TextDatumGetCString(elems[0]))); objnode = (Node *) makeFloat(TextDatumGetCString(elems[0]));
} }
else else
{ {
...@@ -2123,7 +2079,96 @@ pg_get_object_address(PG_FUNCTION_ARGS) ...@@ -2123,7 +2079,96 @@ pg_get_object_address(PG_FUNCTION_ARGS)
break; break;
} }
addr = get_object_address(type, name, args, /*
* Now build the Node type that get_object_name() expects for the given
* type.
*/
switch (type)
{
case OBJECT_TABLE:
case OBJECT_SEQUENCE:
case OBJECT_VIEW:
case OBJECT_MATVIEW:
case OBJECT_INDEX:
case OBJECT_FOREIGN_TABLE:
case OBJECT_COLUMN:
case OBJECT_ATTRIBUTE:
case OBJECT_COLLATION:
case OBJECT_CONVERSION:
case OBJECT_TSPARSER:
case OBJECT_TSDICTIONARY:
case OBJECT_TSTEMPLATE:
case OBJECT_TSCONFIGURATION:
case OBJECT_DEFAULT:
case OBJECT_POLICY:
case OBJECT_RULE:
case OBJECT_TRIGGER:
case OBJECT_TABCONSTRAINT:
case OBJECT_OPCLASS:
case OBJECT_OPFAMILY:
objnode = (Node *) name;
break;
case OBJECT_ACCESS_METHOD:
case OBJECT_DATABASE:
case OBJECT_EVENT_TRIGGER:
case OBJECT_EXTENSION:
case OBJECT_FDW:
case OBJECT_FOREIGN_SERVER:
case OBJECT_LANGUAGE:
case OBJECT_PUBLICATION:
case OBJECT_ROLE:
case OBJECT_SCHEMA:
case OBJECT_SUBSCRIPTION:
case OBJECT_TABLESPACE:
if (list_length(name) != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("name list length must be exactly %d", 1)));
objnode = linitial(name);
break;
case OBJECT_TYPE:
case OBJECT_DOMAIN:
objnode = (Node *) typename;
break;
case OBJECT_CAST:
case OBJECT_DOMCONSTRAINT:
case OBJECT_TRANSFORM:
objnode = (Node *) list_make2(typename, linitial(args));
break;
case OBJECT_PUBLICATION_REL:
objnode = (Node *) list_make2(name, linitial(args));
break;
case OBJECT_USER_MAPPING:
objnode = (Node *) list_make2(linitial(name), linitial(args));
break;
case OBJECT_DEFACL:
objnode = (Node *) lcons(linitial(args), name);
break;
case OBJECT_AMOP:
case OBJECT_AMPROC:
objnode = (Node *) list_make2(name, args);
break;
case OBJECT_FUNCTION:
case OBJECT_AGGREGATE:
case OBJECT_OPERATOR:
{
ObjectWithArgs *owa = makeNode(ObjectWithArgs);
owa->objname = name;
owa->objargs = args;
objnode = (Node *) owa;
break;
}
case OBJECT_LARGEOBJECT:
/* already handled above */
break;
/* no default, to let compiler warn about missing case */
}
if (objnode == NULL)
elog(ERROR, "unrecognized object type: %d", type);
addr = get_object_address(type, objnode,
&relation, AccessShareLock, false); &relation, AccessShareLock, false);
/* We don't need the relcache entry, thank you very much */ /* We don't need the relcache entry, thank you very much */
...@@ -2156,7 +2201,7 @@ pg_get_object_address(PG_FUNCTION_ARGS) ...@@ -2156,7 +2201,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
*/ */
void void
check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
List *objname, List *objargs, Relation relation) Node *object, Relation relation)
{ {
switch (objtype) switch (objtype)
{ {
...@@ -2178,7 +2223,7 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, ...@@ -2178,7 +2223,7 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_DATABASE: case OBJECT_DATABASE:
if (!pg_database_ownercheck(address.objectId, roleid)) if (!pg_database_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_TYPE: case OBJECT_TYPE:
case OBJECT_DOMAIN: case OBJECT_DOMAIN:
...@@ -2191,62 +2236,62 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, ...@@ -2191,62 +2236,62 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_FUNCTION: case OBJECT_FUNCTION:
if (!pg_proc_ownercheck(address.objectId, roleid)) if (!pg_proc_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
NameListToString(objname)); NameListToString((castNode(ObjectWithArgs, object))->objname));
break; break;
case OBJECT_OPERATOR: case OBJECT_OPERATOR:
if (!pg_oper_ownercheck(address.objectId, roleid)) if (!pg_oper_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER,
NameListToString(objname)); NameListToString((castNode(ObjectWithArgs, object))->objname));
break; break;
case OBJECT_SCHEMA: case OBJECT_SCHEMA:
if (!pg_namespace_ownercheck(address.objectId, roleid)) if (!pg_namespace_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_NAMESPACE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_NAMESPACE,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_COLLATION: case OBJECT_COLLATION:
if (!pg_collation_ownercheck(address.objectId, roleid)) if (!pg_collation_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_COLLATION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_COLLATION,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_CONVERSION: case OBJECT_CONVERSION:
if (!pg_conversion_ownercheck(address.objectId, roleid)) if (!pg_conversion_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CONVERSION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CONVERSION,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_EXTENSION: case OBJECT_EXTENSION:
if (!pg_extension_ownercheck(address.objectId, roleid)) if (!pg_extension_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EXTENSION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EXTENSION,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_FDW: case OBJECT_FDW:
if (!pg_foreign_data_wrapper_ownercheck(address.objectId, roleid)) if (!pg_foreign_data_wrapper_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_FDW, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_FDW,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_FOREIGN_SERVER: case OBJECT_FOREIGN_SERVER:
if (!pg_foreign_server_ownercheck(address.objectId, roleid)) if (!pg_foreign_server_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_FOREIGN_SERVER, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_FOREIGN_SERVER,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_EVENT_TRIGGER: case OBJECT_EVENT_TRIGGER:
if (!pg_event_trigger_ownercheck(address.objectId, roleid)) if (!pg_event_trigger_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EVENT_TRIGGER, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EVENT_TRIGGER,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_LANGUAGE: case OBJECT_LANGUAGE:
if (!pg_language_ownercheck(address.objectId, roleid)) if (!pg_language_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_LANGUAGE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_LANGUAGE,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_OPCLASS: case OBJECT_OPCLASS:
if (!pg_opclass_ownercheck(address.objectId, roleid)) if (!pg_opclass_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPCLASS, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPCLASS,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_OPFAMILY: case OBJECT_OPFAMILY:
if (!pg_opfamily_ownercheck(address.objectId, roleid)) if (!pg_opfamily_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPFAMILY, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPFAMILY,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_LARGEOBJECT: case OBJECT_LARGEOBJECT:
if (!lo_compat_privileges && if (!lo_compat_privileges &&
...@@ -2259,8 +2304,8 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, ...@@ -2259,8 +2304,8 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_CAST: case OBJECT_CAST:
{ {
/* We can only check permissions on the source/target types */ /* We can only check permissions on the source/target types */
TypeName *sourcetype = (TypeName *) linitial(objname); TypeName *sourcetype = castNode(TypeName, linitial(castNode(List, object)));
TypeName *targettype = (TypeName *) linitial(objargs); TypeName *targettype = castNode(TypeName, lsecond(castNode(List, object)));
Oid sourcetypeid = typenameTypeId(NULL, sourcetype); Oid sourcetypeid = typenameTypeId(NULL, sourcetype);
Oid targettypeid = typenameTypeId(NULL, targettype); Oid targettypeid = typenameTypeId(NULL, targettype);
...@@ -2276,16 +2321,16 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, ...@@ -2276,16 +2321,16 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_PUBLICATION: case OBJECT_PUBLICATION:
if (!pg_publication_ownercheck(address.objectId, roleid)) if (!pg_publication_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PUBLICATION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PUBLICATION,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_SUBSCRIPTION: case OBJECT_SUBSCRIPTION:
if (!pg_subscription_ownercheck(address.objectId, roleid)) if (!pg_subscription_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_SUBSCRIPTION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_SUBSCRIPTION,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_TRANSFORM: case OBJECT_TRANSFORM:
{ {
TypeName *typename = (TypeName *) linitial(objname); TypeName *typename = castNode(TypeName, linitial(castNode(List, object)));
Oid typeid = typenameTypeId(NULL, typename); Oid typeid = typenameTypeId(NULL, typename);
if (!pg_type_ownercheck(typeid, roleid)) if (!pg_type_ownercheck(typeid, roleid))
...@@ -2295,17 +2340,17 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, ...@@ -2295,17 +2340,17 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_TABLESPACE: case OBJECT_TABLESPACE:
if (!pg_tablespace_ownercheck(address.objectId, roleid)) if (!pg_tablespace_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TABLESPACE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TABLESPACE,
NameListToString(objname)); strVal((Value *) object));
break; break;
case OBJECT_TSDICTIONARY: case OBJECT_TSDICTIONARY:
if (!pg_ts_dict_ownercheck(address.objectId, roleid)) if (!pg_ts_dict_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_TSCONFIGURATION: case OBJECT_TSCONFIGURATION:
if (!pg_ts_config_ownercheck(address.objectId, roleid)) if (!pg_ts_config_ownercheck(address.objectId, roleid))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION,
NameListToString(objname)); NameListToString(castNode(List, object)));
break; break;
case OBJECT_ROLE: case OBJECT_ROLE:
...@@ -4868,7 +4913,7 @@ getObjectIdentityParts(const ObjectAddress *object, ...@@ -4868,7 +4913,7 @@ getObjectIdentityParts(const ObjectAddress *object,
} }
static void static void
getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname) getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **object)
{ {
HeapTuple opfTup; HeapTuple opfTup;
Form_pg_opfamily opfForm; Form_pg_opfamily opfForm;
...@@ -4893,8 +4938,8 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname) ...@@ -4893,8 +4938,8 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname)
NameStr(opfForm->opfname)), NameStr(opfForm->opfname)),
NameStr(amForm->amname)); NameStr(amForm->amname));
if (objname) if (object)
*objname = list_make3(pstrdup(NameStr(amForm->amname)), *object = list_make3(pstrdup(NameStr(amForm->amname)),
pstrdup(schema), pstrdup(schema),
pstrdup(NameStr(opfForm->opfname))); pstrdup(NameStr(opfForm->opfname)));
...@@ -4907,7 +4952,7 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname) ...@@ -4907,7 +4952,7 @@ getOpFamilyIdentity(StringInfo buffer, Oid opfid, List **objname)
* StringInfo. * StringInfo.
*/ */
static void static void
getRelationIdentity(StringInfo buffer, Oid relid, List **objname) getRelationIdentity(StringInfo buffer, Oid relid, List **object)
{ {
HeapTuple relTup; HeapTuple relTup;
Form_pg_class relForm; Form_pg_class relForm;
...@@ -4923,8 +4968,8 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **objname) ...@@ -4923,8 +4968,8 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **objname)
appendStringInfoString(buffer, appendStringInfoString(buffer,
quote_qualified_identifier(schema, quote_qualified_identifier(schema,
NameStr(relForm->relname))); NameStr(relForm->relname)));
if (objname) if (object)
*objname = list_make2(schema, pstrdup(NameStr(relForm->relname))); *object = list_make2(schema, pstrdup(NameStr(relForm->relname)));
ReleaseSysCache(relTup); ReleaseSysCache(relTup);
} }
......
...@@ -385,7 +385,7 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -385,7 +385,7 @@ ExecRenameStmt(RenameStmt *stmt)
Relation relation; Relation relation;
address = get_object_address(stmt->renameType, address = get_object_address(stmt->renameType,
stmt->object, stmt->objarg, stmt->object,
&relation, &relation,
AccessExclusiveLock, false); AccessExclusiveLock, false);
Assert(relation == NULL); Assert(relation == NULL);
...@@ -421,8 +421,8 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre ...@@ -421,8 +421,8 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre
Relation rel; Relation rel;
address = address =
get_object_address_rv(stmt->objectType, stmt->relation, stmt->objname, get_object_address_rv(stmt->objectType, stmt->relation, (List *) stmt->object,
stmt->objargs, &rel, AccessExclusiveLock, false); &rel, AccessExclusiveLock, false);
/* /*
* If a relation was involved, it would have been opened and locked. We * If a relation was involved, it would have been opened and locked. We
...@@ -431,8 +431,8 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre ...@@ -431,8 +431,8 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre
if (rel) if (rel)
heap_close(rel, NoLock); heap_close(rel, NoLock);
refAddr = get_object_address(OBJECT_EXTENSION, list_make1(stmt->extname), refAddr = get_object_address(OBJECT_EXTENSION, (Node *) stmt->extname,
NULL, &rel, AccessExclusiveLock, false); &rel, AccessExclusiveLock, false);
Assert(rel == NULL); Assert(rel == NULL);
if (refAddress) if (refAddress)
*refAddress = refAddr; *refAddress = refAddr;
...@@ -461,7 +461,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, ...@@ -461,7 +461,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt,
switch (stmt->objectType) switch (stmt->objectType)
{ {
case OBJECT_EXTENSION: case OBJECT_EXTENSION:
address = AlterExtensionNamespace(stmt->object, stmt->newschema, address = AlterExtensionNamespace(strVal((Value *) stmt->object), stmt->newschema,
oldSchemaAddr ? &oldNspOid : NULL); oldSchemaAddr ? &oldNspOid : NULL);
break; break;
...@@ -476,7 +476,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, ...@@ -476,7 +476,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt,
case OBJECT_DOMAIN: case OBJECT_DOMAIN:
case OBJECT_TYPE: case OBJECT_TYPE:
address = AlterTypeNamespace(stmt->object, stmt->newschema, address = AlterTypeNamespace(castNode(List, stmt->object), stmt->newschema,
stmt->objectType, stmt->objectType,
oldSchemaAddr ? &oldNspOid : NULL); oldSchemaAddr ? &oldNspOid : NULL);
break; break;
...@@ -501,7 +501,6 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, ...@@ -501,7 +501,6 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt,
address = get_object_address(stmt->objectType, address = get_object_address(stmt->objectType,
stmt->object, stmt->object,
stmt->objarg,
&relation, &relation,
AccessExclusiveLock, AccessExclusiveLock,
false); false);
...@@ -764,33 +763,34 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) ...@@ -764,33 +763,34 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
switch (stmt->objectType) switch (stmt->objectType)
{ {
case OBJECT_DATABASE: case OBJECT_DATABASE:
return AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner); return AlterDatabaseOwner(strVal((Value *) stmt->object), newowner);
case OBJECT_SCHEMA: case OBJECT_SCHEMA:
return AlterSchemaOwner(strVal(linitial(stmt->object)), newowner); return AlterSchemaOwner(strVal((Value *) stmt->object), newowner);
case OBJECT_TYPE: case OBJECT_TYPE:
case OBJECT_DOMAIN: /* same as TYPE */ case OBJECT_DOMAIN: /* same as TYPE */
return AlterTypeOwner(stmt->object, newowner, stmt->objectType); return AlterTypeOwner(castNode(List, stmt->object), newowner, stmt->objectType);
break;
case OBJECT_FDW: case OBJECT_FDW:
return AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)), return AlterForeignDataWrapperOwner(strVal((Value *) stmt->object),
newowner); newowner);
case OBJECT_FOREIGN_SERVER: case OBJECT_FOREIGN_SERVER:
return AlterForeignServerOwner(strVal(linitial(stmt->object)), return AlterForeignServerOwner(strVal((Value *) stmt->object),
newowner); newowner);
case OBJECT_EVENT_TRIGGER: case OBJECT_EVENT_TRIGGER:
return AlterEventTriggerOwner(strVal(linitial(stmt->object)), return AlterEventTriggerOwner(strVal((Value *) stmt->object),
newowner); newowner);
case OBJECT_PUBLICATION: case OBJECT_PUBLICATION:
return AlterPublicationOwner(strVal(linitial(stmt->object)), return AlterPublicationOwner(strVal((Value *) stmt->object),
newowner); newowner);
case OBJECT_SUBSCRIPTION: case OBJECT_SUBSCRIPTION:
return AlterSubscriptionOwner(strVal(linitial(stmt->object)), return AlterSubscriptionOwner(strVal((Value *) stmt->object),
newowner); newowner);
/* Generic cases */ /* Generic cases */
...@@ -814,7 +814,6 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) ...@@ -814,7 +814,6 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
address = get_object_address(stmt->objectType, address = get_object_address(stmt->objectType,
stmt->object, stmt->object,
stmt->objarg,
&relation, &relation,
AccessExclusiveLock, AccessExclusiveLock,
false); false);
......
...@@ -48,12 +48,11 @@ CommentObject(CommentStmt *stmt) ...@@ -48,12 +48,11 @@ CommentObject(CommentStmt *stmt)
* (which is really pg_restore's fault, but for now we will work around * (which is really pg_restore's fault, but for now we will work around
* the problem here). Consensus is that the best fix is to treat wrong * the problem here). Consensus is that the best fix is to treat wrong
* database name as a WARNING not an ERROR; hence, the following special * database name as a WARNING not an ERROR; hence, the following special
* case. (If the length of stmt->objname is not 1, get_object_address * case.
* will throw an error below; that's OK.)
*/ */
if (stmt->objtype == OBJECT_DATABASE && list_length(stmt->objname) == 1) if (stmt->objtype == OBJECT_DATABASE)
{ {
char *database = strVal(linitial(stmt->objname)); char *database = strVal((Value *) stmt->object);
if (!OidIsValid(get_database_oid(database, true))) if (!OidIsValid(get_database_oid(database, true)))
{ {
...@@ -70,12 +69,12 @@ CommentObject(CommentStmt *stmt) ...@@ -70,12 +69,12 @@ CommentObject(CommentStmt *stmt)
* does not exist, and will also acquire a lock on the target to guard * does not exist, and will also acquire a lock on the target to guard
* against concurrent DROP operations. * against concurrent DROP operations.
*/ */
address = get_object_address(stmt->objtype, stmt->objname, stmt->objargs, address = get_object_address(stmt->objtype, stmt->object,
&relation, ShareUpdateExclusiveLock, false); &relation, ShareUpdateExclusiveLock, false);
/* Require ownership of the target object. */ /* Require ownership of the target object. */
check_object_ownership(GetUserId(), stmt->objtype, address, check_object_ownership(GetUserId(), stmt->objtype, address,
stmt->objname, stmt->objargs, relation); stmt->object, relation);
/* Perform other integrity checks as needed. */ /* Perform other integrity checks as needed. */
switch (stmt->objtype) switch (stmt->objtype)
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
static void does_not_exist_skipping(ObjectType objtype, static void does_not_exist_skipping(ObjectType objtype,
List *objname, List *objargs); Node *object);
static bool owningrel_does_not_exist_skipping(List *objname, static bool owningrel_does_not_exist_skipping(List *object,
const char **msg, char **name); const char **msg, char **name);
static bool schema_does_not_exist_skipping(List *objname, static bool schema_does_not_exist_skipping(List *object,
const char **msg, char **name); const char **msg, char **name);
static bool type_in_list_does_not_exist_skipping(List *typenames, static bool type_in_list_does_not_exist_skipping(List *typenames,
const char **msg, char **name); const char **msg, char **name);
...@@ -55,27 +55,19 @@ RemoveObjects(DropStmt *stmt) ...@@ -55,27 +55,19 @@ RemoveObjects(DropStmt *stmt)
{ {
ObjectAddresses *objects; ObjectAddresses *objects;
ListCell *cell1; ListCell *cell1;
ListCell *cell2 = NULL;
objects = new_object_addresses(); objects = new_object_addresses();
foreach(cell1, stmt->objects) foreach(cell1, stmt->objects)
{ {
ObjectAddress address; ObjectAddress address;
List *objname = lfirst(cell1); Node *object = lfirst(cell1);
List *objargs = NIL;
Relation relation = NULL; Relation relation = NULL;
Oid namespaceId; Oid namespaceId;
if (stmt->arguments)
{
cell2 = (!cell2 ? list_head(stmt->arguments) : lnext(cell2));
objargs = lfirst(cell2);
}
/* Get an ObjectAddress for the object. */ /* Get an ObjectAddress for the object. */
address = get_object_address(stmt->removeType, address = get_object_address(stmt->removeType,
objname, objargs, object,
&relation, &relation,
AccessExclusiveLock, AccessExclusiveLock,
stmt->missing_ok); stmt->missing_ok);
...@@ -88,7 +80,7 @@ RemoveObjects(DropStmt *stmt) ...@@ -88,7 +80,7 @@ RemoveObjects(DropStmt *stmt)
if (!OidIsValid(address.objectId)) if (!OidIsValid(address.objectId))
{ {
Assert(stmt->missing_ok); Assert(stmt->missing_ok);
does_not_exist_skipping(stmt->removeType, objname, objargs); does_not_exist_skipping(stmt->removeType, object);
continue; continue;
} }
...@@ -110,7 +102,7 @@ RemoveObjects(DropStmt *stmt) ...@@ -110,7 +102,7 @@ RemoveObjects(DropStmt *stmt)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is an aggregate function", errmsg("\"%s\" is an aggregate function",
NameListToString(objname)), NameListToString(castNode(ObjectWithArgs, object)->objname)),
errhint("Use DROP AGGREGATE to drop aggregate functions."))); errhint("Use DROP AGGREGATE to drop aggregate functions.")));
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -121,7 +113,7 @@ RemoveObjects(DropStmt *stmt) ...@@ -121,7 +113,7 @@ RemoveObjects(DropStmt *stmt)
if (!OidIsValid(namespaceId) || if (!OidIsValid(namespaceId) ||
!pg_namespace_ownercheck(namespaceId, GetUserId())) !pg_namespace_ownercheck(namespaceId, GetUserId()))
check_object_ownership(GetUserId(), stmt->removeType, address, check_object_ownership(GetUserId(), stmt->removeType, address,
objname, objargs, relation); object, relation);
/* Release any relcache reference count, but keep lock until commit. */ /* Release any relcache reference count, but keep lock until commit. */
if (relation) if (relation)
...@@ -147,23 +139,23 @@ RemoveObjects(DropStmt *stmt) ...@@ -147,23 +139,23 @@ RemoveObjects(DropStmt *stmt)
* exist, fill the error message format string and name, and return true. * exist, fill the error message format string and name, and return true.
*/ */
static bool static bool
owningrel_does_not_exist_skipping(List *objname, const char **msg, char **name) owningrel_does_not_exist_skipping(List *object, const char **msg, char **name)
{ {
List *parent_objname; List *parent_object;
RangeVar *parent_rel; RangeVar *parent_rel;
parent_objname = list_truncate(list_copy(objname), parent_object = list_truncate(list_copy(object),
list_length(objname) - 1); list_length(object) - 1);
if (schema_does_not_exist_skipping(parent_objname, msg, name)) if (schema_does_not_exist_skipping(parent_object, msg, name))
return true; return true;
parent_rel = makeRangeVarFromNameList(parent_objname); parent_rel = makeRangeVarFromNameList(parent_object);
if (!OidIsValid(RangeVarGetRelid(parent_rel, NoLock, true))) if (!OidIsValid(RangeVarGetRelid(parent_rel, NoLock, true)))
{ {
*msg = gettext_noop("relation \"%s\" does not exist, skipping"); *msg = gettext_noop("relation \"%s\" does not exist, skipping");
*name = NameListToString(parent_objname); *name = NameListToString(parent_object);
return true; return true;
} }
...@@ -183,11 +175,11 @@ owningrel_does_not_exist_skipping(List *objname, const char **msg, char **name) ...@@ -183,11 +175,11 @@ owningrel_does_not_exist_skipping(List *objname, const char **msg, char **name)
* specified schema name, and return true. * specified schema name, and return true.
*/ */
static bool static bool
schema_does_not_exist_skipping(List *objname, const char **msg, char **name) schema_does_not_exist_skipping(List *object, const char **msg, char **name)
{ {
RangeVar *rel; RangeVar *rel;
rel = makeRangeVarFromNameList(objname); rel = makeRangeVarFromNameList(object);
if (rel->schemaname != NULL && if (rel->schemaname != NULL &&
!OidIsValid(LookupNamespaceNoError(rel->schemaname))) !OidIsValid(LookupNamespaceNoError(rel->schemaname)))
...@@ -252,7 +244,7 @@ type_in_list_does_not_exist_skipping(List *typenames, const char **msg, ...@@ -252,7 +244,7 @@ type_in_list_does_not_exist_skipping(List *typenames, const char **msg,
* get_object_address() in RemoveObjects would have thrown an ERROR. * get_object_address() in RemoveObjects would have thrown an ERROR.
*/ */
static void static void
does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) does_not_exist_skipping(ObjectType objtype, Node *object)
{ {
const char *msg = NULL; const char *msg = NULL;
char *name = NULL; char *name = NULL;
...@@ -262,12 +254,12 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) ...@@ -262,12 +254,12 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs)
{ {
case OBJECT_ACCESS_METHOD: case OBJECT_ACCESS_METHOD:
msg = gettext_noop("access method \"%s\" does not exist, skipping"); msg = gettext_noop("access method \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_TYPE: case OBJECT_TYPE:
case OBJECT_DOMAIN: case OBJECT_DOMAIN:
{ {
TypeName *typ = linitial(objname); TypeName *typ = castNode(TypeName, object);
if (!schema_does_not_exist_skipping(typ->names, &msg, &name)) if (!schema_does_not_exist_skipping(typ->names, &msg, &name))
{ {
...@@ -277,171 +269,180 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) ...@@ -277,171 +269,180 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs)
} }
break; break;
case OBJECT_COLLATION: case OBJECT_COLLATION:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("collation \"%s\" does not exist, skipping"); msg = gettext_noop("collation \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_CONVERSION: case OBJECT_CONVERSION:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("conversion \"%s\" does not exist, skipping"); msg = gettext_noop("conversion \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_SCHEMA: case OBJECT_SCHEMA:
msg = gettext_noop("schema \"%s\" does not exist, skipping"); msg = gettext_noop("schema \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_TSPARSER: case OBJECT_TSPARSER:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("text search parser \"%s\" does not exist, skipping"); msg = gettext_noop("text search parser \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_TSDICTIONARY: case OBJECT_TSDICTIONARY:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("text search dictionary \"%s\" does not exist, skipping"); msg = gettext_noop("text search dictionary \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_TSTEMPLATE: case OBJECT_TSTEMPLATE:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("text search template \"%s\" does not exist, skipping"); msg = gettext_noop("text search template \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_TSCONFIGURATION: case OBJECT_TSCONFIGURATION:
if (!schema_does_not_exist_skipping(objname, &msg, &name)) if (!schema_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("text search configuration \"%s\" does not exist, skipping"); msg = gettext_noop("text search configuration \"%s\" does not exist, skipping");
name = NameListToString(objname); name = NameListToString(castNode(List, object));
} }
break; break;
case OBJECT_EXTENSION: case OBJECT_EXTENSION:
msg = gettext_noop("extension \"%s\" does not exist, skipping"); msg = gettext_noop("extension \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_FUNCTION: case OBJECT_FUNCTION:
if (!schema_does_not_exist_skipping(objname, &msg, &name) &&
!type_in_list_does_not_exist_skipping(objargs, &msg, &name))
{ {
msg = gettext_noop("function %s(%s) does not exist, skipping"); ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
name = NameListToString(objname); if (!schema_does_not_exist_skipping(owa->objname, &msg, &name) &&
args = TypeNameListToString(objargs); !type_in_list_does_not_exist_skipping(owa->objargs, &msg, &name))
{
msg = gettext_noop("function %s(%s) does not exist, skipping");
name = NameListToString(owa->objname);
args = TypeNameListToString(owa->objargs);
}
break;
} }
break;
case OBJECT_AGGREGATE: case OBJECT_AGGREGATE:
if (!schema_does_not_exist_skipping(objname, &msg, &name) &&
!type_in_list_does_not_exist_skipping(objargs, &msg, &name))
{ {
msg = gettext_noop("aggregate %s(%s) does not exist, skipping"); ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
name = NameListToString(objname); if (!schema_does_not_exist_skipping(owa->objname, &msg, &name) &&
args = TypeNameListToString(objargs); !type_in_list_does_not_exist_skipping(owa->objargs, &msg, &name))
{
msg = gettext_noop("aggregate %s(%s) does not exist, skipping");
name = NameListToString(owa->objname);
args = TypeNameListToString(owa->objargs);
}
break;
} }
break;
case OBJECT_OPERATOR: case OBJECT_OPERATOR:
if (!schema_does_not_exist_skipping(objname, &msg, &name) &&
!type_in_list_does_not_exist_skipping(objargs, &msg, &name))
{ {
msg = gettext_noop("operator %s does not exist, skipping"); ObjectWithArgs *owa = castNode(ObjectWithArgs, object);
name = NameListToString(objname); if (!schema_does_not_exist_skipping(owa->objname, &msg, &name) &&
!type_in_list_does_not_exist_skipping(owa->objargs, &msg, &name))
{
msg = gettext_noop("operator %s does not exist, skipping");
name = NameListToString(owa->objname);
}
break;
} }
break;
case OBJECT_LANGUAGE: case OBJECT_LANGUAGE:
msg = gettext_noop("language \"%s\" does not exist, skipping"); msg = gettext_noop("language \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_CAST: case OBJECT_CAST:
{ {
if (!type_in_list_does_not_exist_skipping(objname, &msg, &name) && if (!type_in_list_does_not_exist_skipping(list_make1(linitial(castNode(List, object))), &msg, &name) &&
!type_in_list_does_not_exist_skipping(objargs, &msg, &name)) !type_in_list_does_not_exist_skipping(list_make1(lsecond(castNode(List, object))), &msg, &name))
{ {
/* XXX quote or no quote? */ /* XXX quote or no quote? */
msg = gettext_noop("cast from type %s to type %s does not exist, skipping"); msg = gettext_noop("cast from type %s to type %s does not exist, skipping");
name = TypeNameToString((TypeName *) linitial(objname)); name = TypeNameToString(castNode(TypeName, linitial(castNode(List, object))));
args = TypeNameToString((TypeName *) linitial(objargs)); args = TypeNameToString(castNode(TypeName, lsecond(castNode(List, object))));
} }
} }
break; break;
case OBJECT_TRANSFORM: case OBJECT_TRANSFORM:
if (!type_in_list_does_not_exist_skipping(objname, &msg, &name)) if (!type_in_list_does_not_exist_skipping(list_make1(linitial(castNode(List, object))), &msg, &name))
{ {
msg = gettext_noop("transform for type %s language \"%s\" does not exist, skipping"); msg = gettext_noop("transform for type %s language \"%s\" does not exist, skipping");
name = TypeNameToString((TypeName *) linitial(objname)); name = TypeNameToString(castNode(TypeName, linitial(castNode(List, object))));
args = strVal(linitial(objargs)); args = strVal(lsecond(castNode(List, object)));
} }
break; break;
case OBJECT_TRIGGER: case OBJECT_TRIGGER:
if (!owningrel_does_not_exist_skipping(objname, &msg, &name)) if (!owningrel_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("trigger \"%s\" for relation \"%s\" does not exist, skipping"); msg = gettext_noop("trigger \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(objname)); name = strVal(llast(castNode(List, object)));
args = NameListToString(list_truncate(list_copy(objname), args = NameListToString(list_truncate(list_copy(castNode(List, object)),
list_length(objname) - 1)); list_length(castNode(List, object)) - 1));
} }
break; break;
case OBJECT_POLICY: case OBJECT_POLICY:
if (!owningrel_does_not_exist_skipping(objname, &msg, &name)) if (!owningrel_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("policy \"%s\" for relation \"%s\" does not exist, skipping"); msg = gettext_noop("policy \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(objname)); name = strVal(llast(castNode(List, object)));
args = NameListToString(list_truncate(list_copy(objname), args = NameListToString(list_truncate(list_copy(castNode(List, object)),
list_length(objname) - 1)); list_length(castNode(List, object)) - 1));
} }
break; break;
case OBJECT_EVENT_TRIGGER: case OBJECT_EVENT_TRIGGER:
msg = gettext_noop("event trigger \"%s\" does not exist, skipping"); msg = gettext_noop("event trigger \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_RULE: case OBJECT_RULE:
if (!owningrel_does_not_exist_skipping(objname, &msg, &name)) if (!owningrel_does_not_exist_skipping(castNode(List, object), &msg, &name))
{ {
msg = gettext_noop("rule \"%s\" for relation \"%s\" does not exist, skipping"); msg = gettext_noop("rule \"%s\" for relation \"%s\" does not exist, skipping");
name = strVal(llast(objname)); name = strVal(llast(castNode(List, object)));
args = NameListToString(list_truncate(list_copy(objname), args = NameListToString(list_truncate(list_copy(castNode(List, object)),
list_length(objname) - 1)); list_length(castNode(List, object)) - 1));
} }
break; break;
case OBJECT_FDW: case OBJECT_FDW:
msg = gettext_noop("foreign-data wrapper \"%s\" does not exist, skipping"); msg = gettext_noop("foreign-data wrapper \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_FOREIGN_SERVER: case OBJECT_FOREIGN_SERVER:
msg = gettext_noop("server \"%s\" does not exist, skipping"); msg = gettext_noop("server \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
case OBJECT_OPCLASS: case OBJECT_OPCLASS:
{ {
List *opcname = list_copy_tail(objname, 1); List *opcname = list_copy_tail(castNode(List, object), 1);
if (!schema_does_not_exist_skipping(opcname, &msg, &name)) if (!schema_does_not_exist_skipping(opcname, &msg, &name))
{ {
msg = gettext_noop("operator class \"%s\" does not exist for access method \"%s\", skipping"); msg = gettext_noop("operator class \"%s\" does not exist for access method \"%s\", skipping");
name = NameListToString(opcname); name = NameListToString(opcname);
args = strVal(linitial(objname)); args = strVal(linitial(castNode(List, object)));
} }
} }
break; break;
case OBJECT_OPFAMILY: case OBJECT_OPFAMILY:
{ {
List *opfname = list_copy_tail(objname, 1); List *opfname = list_copy_tail(castNode(List, object), 1);
if (!schema_does_not_exist_skipping(opfname, &msg, &name)) if (!schema_does_not_exist_skipping(opfname, &msg, &name))
{ {
msg = gettext_noop("operator family \"%s\" does not exist for access method \"%s\", skipping"); msg = gettext_noop("operator family \"%s\" does not exist for access method \"%s\", skipping");
name = NameListToString(opfname); name = NameListToString(opfname);
args = strVal(linitial(objname)); args = strVal(linitial(castNode(List, object)));
} }
} }
break; break;
case OBJECT_PUBLICATION: case OBJECT_PUBLICATION:
msg = gettext_noop("publication \"%s\" does not exist, skipping"); msg = gettext_noop("publication \"%s\" does not exist, skipping");
name = NameListToString(objname); name = strVal((Value *) object);
break; break;
default: default:
elog(ERROR, "unrecognized object type: %d", (int) objtype); elog(ERROR, "unrecognized object type: %d", (int) objtype);
......
...@@ -2672,9 +2672,8 @@ extension_config_remove(Oid extensionoid, Oid tableoid) ...@@ -2672,9 +2672,8 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
* Execute ALTER EXTENSION SET SCHEMA * Execute ALTER EXTENSION SET SCHEMA
*/ */
ObjectAddress ObjectAddress
AlterExtensionNamespace(List *names, const char *newschema, Oid *oldschema) AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *oldschema)
{ {
char *extensionName;
Oid extensionOid; Oid extensionOid;
Oid nspOid; Oid nspOid;
Oid oldNspOid = InvalidOid; Oid oldNspOid = InvalidOid;
...@@ -2690,12 +2689,6 @@ AlterExtensionNamespace(List *names, const char *newschema, Oid *oldschema) ...@@ -2690,12 +2689,6 @@ AlterExtensionNamespace(List *names, const char *newschema, Oid *oldschema)
ObjectAddresses *objsMoved; ObjectAddresses *objsMoved;
ObjectAddress extAddr; ObjectAddress extAddr;
if (list_length(names) != 1)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("extension name cannot be qualified")));
extensionName = strVal(linitial(names));
extensionOid = get_extension_oid(extensionName, false); extensionOid = get_extension_oid(extensionName, false);
nspOid = LookupCreationNamespace(newschema); nspOid = LookupCreationNamespace(newschema);
...@@ -3191,7 +3184,7 @@ ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt, ...@@ -3191,7 +3184,7 @@ ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt,
* does not exist, and will also acquire a lock on the object to guard * does not exist, and will also acquire a lock on the object to guard
* against concurrent DROP and ALTER EXTENSION ADD/DROP operations. * against concurrent DROP and ALTER EXTENSION ADD/DROP operations.
*/ */
object = get_object_address(stmt->objtype, stmt->objname, stmt->objargs, object = get_object_address(stmt->objtype, stmt->object,
&relation, ShareUpdateExclusiveLock, false); &relation, ShareUpdateExclusiveLock, false);
Assert(object.objectSubId == 0); Assert(object.objectSubId == 0);
...@@ -3200,7 +3193,7 @@ ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt, ...@@ -3200,7 +3193,7 @@ ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt,
/* Permission check: must own target object, too */ /* Permission check: must own target object, too */
check_object_ownership(GetUserId(), stmt->objtype, object, check_object_ownership(GetUserId(), stmt->objtype, object,
stmt->objname, stmt->objargs, relation); stmt->object, relation);
/* /*
* Check existing extension membership. * Check existing extension membership.
......
...@@ -89,12 +89,12 @@ ExecSecLabelStmt(SecLabelStmt *stmt) ...@@ -89,12 +89,12 @@ ExecSecLabelStmt(SecLabelStmt *stmt)
* object does not exist, and will also acquire a lock on the target to * object does not exist, and will also acquire a lock on the target to
* guard against concurrent modifications. * guard against concurrent modifications.
*/ */
address = get_object_address(stmt->objtype, stmt->objname, stmt->objargs, address = get_object_address(stmt->objtype, stmt->object,
&relation, ShareUpdateExclusiveLock, false); &relation, ShareUpdateExclusiveLock, false);
/* Require ownership of the target object. */ /* Require ownership of the target object. */
check_object_ownership(GetUserId(), stmt->objtype, address, check_object_ownership(GetUserId(), stmt->objtype, address,
stmt->objname, stmt->objargs, relation); stmt->object, relation);
/* Perform other integrity checks as needed. */ /* Perform other integrity checks as needed. */
switch (stmt->objtype) switch (stmt->objtype)
......
...@@ -2786,7 +2786,7 @@ RenameConstraint(RenameStmt *stmt) ...@@ -2786,7 +2786,7 @@ RenameConstraint(RenameStmt *stmt)
Relation rel; Relation rel;
HeapTuple tup; HeapTuple tup;
typid = typenameTypeId(NULL, makeTypeNameFromNameList(stmt->object)); typid = typenameTypeId(NULL, makeTypeNameFromNameList(castNode(List, stmt->object)));
rel = heap_open(TypeRelationId, RowExclusiveLock); rel = heap_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid)); tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
...@@ -9392,11 +9392,9 @@ RebuildConstraintComment(AlteredTableInfo *tab, int pass, Oid objid, ...@@ -9392,11 +9392,9 @@ RebuildConstraintComment(AlteredTableInfo *tab, int pass, Oid objid,
/* Build node CommentStmt */ /* Build node CommentStmt */
cmd = makeNode(CommentStmt); cmd = makeNode(CommentStmt);
cmd->objtype = OBJECT_TABCONSTRAINT; cmd->objtype = OBJECT_TABCONSTRAINT;
cmd->objname = list_make3( cmd->object = (Node *) list_make3(makeString(get_namespace_name(RelationGetNamespace(rel))),
makeString(get_namespace_name(RelationGetNamespace(rel))), makeString(RelationGetRelationName(rel)),
makeString(RelationGetRelationName(rel)), makeString(conname));
makeString(conname));
cmd->objargs = NIL;
cmd->comment = comment_str; cmd->comment = comment_str;
/* Append it to list of commands */ /* Append it to list of commands */
......
...@@ -3133,7 +3133,7 @@ replace_domain_constraint_value(ParseState *pstate, ColumnRef *cref) ...@@ -3133,7 +3133,7 @@ replace_domain_constraint_value(ParseState *pstate, ColumnRef *cref)
ObjectAddress ObjectAddress
RenameType(RenameStmt *stmt) RenameType(RenameStmt *stmt)
{ {
List *names = stmt->object; List *names = castNode(List, stmt->object);
const char *newTypeName = stmt->newname; const char *newTypeName = stmt->newname;
TypeName *typename; TypeName *typename;
Oid typeOid; Oid typeOid;
......
...@@ -3116,7 +3116,6 @@ _copyDropStmt(const DropStmt *from) ...@@ -3116,7 +3116,6 @@ _copyDropStmt(const DropStmt *from)
DropStmt *newnode = makeNode(DropStmt); DropStmt *newnode = makeNode(DropStmt);
COPY_NODE_FIELD(objects); COPY_NODE_FIELD(objects);
COPY_NODE_FIELD(arguments);
COPY_SCALAR_FIELD(removeType); COPY_SCALAR_FIELD(removeType);
COPY_SCALAR_FIELD(behavior); COPY_SCALAR_FIELD(behavior);
COPY_SCALAR_FIELD(missing_ok); COPY_SCALAR_FIELD(missing_ok);
...@@ -3143,8 +3142,7 @@ _copyCommentStmt(const CommentStmt *from) ...@@ -3143,8 +3142,7 @@ _copyCommentStmt(const CommentStmt *from)
CommentStmt *newnode = makeNode(CommentStmt); CommentStmt *newnode = makeNode(CommentStmt);
COPY_SCALAR_FIELD(objtype); COPY_SCALAR_FIELD(objtype);
COPY_NODE_FIELD(objname); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objargs);
COPY_STRING_FIELD(comment); COPY_STRING_FIELD(comment);
return newnode; return newnode;
...@@ -3156,8 +3154,7 @@ _copySecLabelStmt(const SecLabelStmt *from) ...@@ -3156,8 +3154,7 @@ _copySecLabelStmt(const SecLabelStmt *from)
SecLabelStmt *newnode = makeNode(SecLabelStmt); SecLabelStmt *newnode = makeNode(SecLabelStmt);
COPY_SCALAR_FIELD(objtype); COPY_SCALAR_FIELD(objtype);
COPY_NODE_FIELD(objname); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objargs);
COPY_STRING_FIELD(provider); COPY_STRING_FIELD(provider);
COPY_STRING_FIELD(label); COPY_STRING_FIELD(label);
...@@ -3263,7 +3260,6 @@ _copyRenameStmt(const RenameStmt *from) ...@@ -3263,7 +3260,6 @@ _copyRenameStmt(const RenameStmt *from)
COPY_SCALAR_FIELD(relationType); COPY_SCALAR_FIELD(relationType);
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(object); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objarg);
COPY_STRING_FIELD(subname); COPY_STRING_FIELD(subname);
COPY_STRING_FIELD(newname); COPY_STRING_FIELD(newname);
COPY_SCALAR_FIELD(behavior); COPY_SCALAR_FIELD(behavior);
...@@ -3279,8 +3275,7 @@ _copyAlterObjectDependsStmt(const AlterObjectDependsStmt *from) ...@@ -3279,8 +3275,7 @@ _copyAlterObjectDependsStmt(const AlterObjectDependsStmt *from)
COPY_SCALAR_FIELD(objectType); COPY_SCALAR_FIELD(objectType);
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(objname); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objargs);
COPY_NODE_FIELD(extname); COPY_NODE_FIELD(extname);
return newnode; return newnode;
...@@ -3294,7 +3289,6 @@ _copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from) ...@@ -3294,7 +3289,6 @@ _copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from)
COPY_SCALAR_FIELD(objectType); COPY_SCALAR_FIELD(objectType);
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(object); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objarg);
COPY_STRING_FIELD(newschema); COPY_STRING_FIELD(newschema);
COPY_SCALAR_FIELD(missing_ok); COPY_SCALAR_FIELD(missing_ok);
...@@ -3309,7 +3303,6 @@ _copyAlterOwnerStmt(const AlterOwnerStmt *from) ...@@ -3309,7 +3303,6 @@ _copyAlterOwnerStmt(const AlterOwnerStmt *from)
COPY_SCALAR_FIELD(objectType); COPY_SCALAR_FIELD(objectType);
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(object); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objarg);
COPY_NODE_FIELD(newowner); COPY_NODE_FIELD(newowner);
return newnode; return newnode;
...@@ -3780,8 +3773,7 @@ _copyAlterExtensionContentsStmt(const AlterExtensionContentsStmt *from) ...@@ -3780,8 +3773,7 @@ _copyAlterExtensionContentsStmt(const AlterExtensionContentsStmt *from)
COPY_STRING_FIELD(extname); COPY_STRING_FIELD(extname);
COPY_SCALAR_FIELD(action); COPY_SCALAR_FIELD(action);
COPY_SCALAR_FIELD(objtype); COPY_SCALAR_FIELD(objtype);
COPY_NODE_FIELD(objname); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objargs);
return newnode; return newnode;
} }
......
...@@ -1220,7 +1220,6 @@ static bool ...@@ -1220,7 +1220,6 @@ static bool
_equalDropStmt(const DropStmt *a, const DropStmt *b) _equalDropStmt(const DropStmt *a, const DropStmt *b)
{ {
COMPARE_NODE_FIELD(objects); COMPARE_NODE_FIELD(objects);
COMPARE_NODE_FIELD(arguments);
COMPARE_SCALAR_FIELD(removeType); COMPARE_SCALAR_FIELD(removeType);
COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(behavior);
COMPARE_SCALAR_FIELD(missing_ok); COMPARE_SCALAR_FIELD(missing_ok);
...@@ -1243,8 +1242,7 @@ static bool ...@@ -1243,8 +1242,7 @@ static bool
_equalCommentStmt(const CommentStmt *a, const CommentStmt *b) _equalCommentStmt(const CommentStmt *a, const CommentStmt *b)
{ {
COMPARE_SCALAR_FIELD(objtype); COMPARE_SCALAR_FIELD(objtype);
COMPARE_NODE_FIELD(objname); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objargs);
COMPARE_STRING_FIELD(comment); COMPARE_STRING_FIELD(comment);
return true; return true;
...@@ -1254,8 +1252,7 @@ static bool ...@@ -1254,8 +1252,7 @@ static bool
_equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b) _equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b)
{ {
COMPARE_SCALAR_FIELD(objtype); COMPARE_SCALAR_FIELD(objtype);
COMPARE_NODE_FIELD(objname); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objargs);
COMPARE_STRING_FIELD(provider); COMPARE_STRING_FIELD(provider);
COMPARE_STRING_FIELD(label); COMPARE_STRING_FIELD(label);
...@@ -1347,7 +1344,6 @@ _equalRenameStmt(const RenameStmt *a, const RenameStmt *b) ...@@ -1347,7 +1344,6 @@ _equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
COMPARE_SCALAR_FIELD(relationType); COMPARE_SCALAR_FIELD(relationType);
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objarg);
COMPARE_STRING_FIELD(subname); COMPARE_STRING_FIELD(subname);
COMPARE_STRING_FIELD(newname); COMPARE_STRING_FIELD(newname);
COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(behavior);
...@@ -1361,8 +1357,7 @@ _equalAlterObjectDependsStmt(const AlterObjectDependsStmt *a, const AlterObjectD ...@@ -1361,8 +1357,7 @@ _equalAlterObjectDependsStmt(const AlterObjectDependsStmt *a, const AlterObjectD
{ {
COMPARE_SCALAR_FIELD(objectType); COMPARE_SCALAR_FIELD(objectType);
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(objname); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objargs);
COMPARE_NODE_FIELD(extname); COMPARE_NODE_FIELD(extname);
return true; return true;
...@@ -1374,7 +1369,6 @@ _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSch ...@@ -1374,7 +1369,6 @@ _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSch
COMPARE_SCALAR_FIELD(objectType); COMPARE_SCALAR_FIELD(objectType);
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objarg);
COMPARE_STRING_FIELD(newschema); COMPARE_STRING_FIELD(newschema);
COMPARE_SCALAR_FIELD(missing_ok); COMPARE_SCALAR_FIELD(missing_ok);
...@@ -1387,7 +1381,6 @@ _equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b) ...@@ -1387,7 +1381,6 @@ _equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b)
COMPARE_SCALAR_FIELD(objectType); COMPARE_SCALAR_FIELD(objectType);
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objarg);
COMPARE_NODE_FIELD(newowner); COMPARE_NODE_FIELD(newowner);
return true; return true;
...@@ -1783,8 +1776,7 @@ _equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const Alte ...@@ -1783,8 +1776,7 @@ _equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const Alte
COMPARE_STRING_FIELD(extname); COMPARE_STRING_FIELD(extname);
COMPARE_SCALAR_FIELD(action); COMPARE_SCALAR_FIELD(action);
COMPARE_SCALAR_FIELD(objtype); COMPARE_SCALAR_FIELD(objtype);
COMPARE_NODE_FIELD(objname); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objargs);
return true; return true;
} }
......
...@@ -440,7 +440,9 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query); ...@@ -440,7 +440,9 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <boolean> copy_from opt_program %type <boolean> copy_from opt_program
%type <ival> opt_column event cursor_options opt_hold opt_set_data %type <ival> opt_column event cursor_options opt_hold opt_set_data
%type <objtype> drop_type comment_type security_label_type %type <objtype> drop_type_any_name drop_type_name
comment_type_any_name comment_type_name
security_label_type_any_name security_label_type_name
%type <node> fetch_args limit_clause select_limit_value %type <node> fetch_args limit_clause select_limit_value
offset_clause select_offset_value offset_clause select_offset_value
...@@ -4080,8 +4082,7 @@ DropPLangStmt: ...@@ -4080,8 +4082,7 @@ DropPLangStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_LANGUAGE; n->removeType = OBJECT_LANGUAGE;
n->objects = list_make1(list_make1(makeString($4))); n->objects = list_make1(makeString($4));
n->arguments = NIL;
n->behavior = $5; n->behavior = $5;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -4091,7 +4092,7 @@ DropPLangStmt: ...@@ -4091,7 +4092,7 @@ DropPLangStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_LANGUAGE; n->removeType = OBJECT_LANGUAGE;
n->objects = list_make1(list_make1(makeString($6))); n->objects = list_make1(makeString($6));
n->behavior = $7; n->behavior = $7;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -4246,7 +4247,7 @@ AlterExtensionContentsStmt: ...@@ -4246,7 +4247,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_ACCESS_METHOD; n->objtype = OBJECT_ACCESS_METHOD;
n->objname = list_make1(makeString($7)); n->object = (Node *) makeString($7);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes | ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes
...@@ -4255,8 +4256,7 @@ AlterExtensionContentsStmt: ...@@ -4255,8 +4256,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_AGGREGATE; n->objtype = OBJECT_AGGREGATE;
n->objname = $6->objname; n->object = (Node *) $6;
n->objargs = $6->objargs;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')' | ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
...@@ -4265,8 +4265,7 @@ AlterExtensionContentsStmt: ...@@ -4265,8 +4265,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_CAST; n->objtype = OBJECT_CAST;
n->objname = list_make1($7); n->object = (Node *) list_make2($7, $9);
n->objargs = list_make1($9);
$$ = (Node *) n; $$ = (Node *) n;
} }
| ALTER EXTENSION name add_drop COLLATION any_name | ALTER EXTENSION name add_drop COLLATION any_name
...@@ -4275,7 +4274,7 @@ AlterExtensionContentsStmt: ...@@ -4275,7 +4274,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_COLLATION; n->objtype = OBJECT_COLLATION;
n->objname = $6; n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop CONVERSION_P any_name | ALTER EXTENSION name add_drop CONVERSION_P any_name
...@@ -4284,7 +4283,7 @@ AlterExtensionContentsStmt: ...@@ -4284,7 +4283,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_CONVERSION; n->objtype = OBJECT_CONVERSION;
n->objname = $6; n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop DOMAIN_P Typename | ALTER EXTENSION name add_drop DOMAIN_P Typename
...@@ -4293,7 +4292,7 @@ AlterExtensionContentsStmt: ...@@ -4293,7 +4292,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_DOMAIN; n->objtype = OBJECT_DOMAIN;
n->objname = list_make1($6); n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop FUNCTION function_with_argtypes | ALTER EXTENSION name add_drop FUNCTION function_with_argtypes
...@@ -4302,8 +4301,7 @@ AlterExtensionContentsStmt: ...@@ -4302,8 +4301,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_FUNCTION; n->objtype = OBJECT_FUNCTION;
n->objname = $6->objname; n->object = (Node *) $6;
n->objargs = $6->objargs;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop opt_procedural LANGUAGE name | ALTER EXTENSION name add_drop opt_procedural LANGUAGE name
...@@ -4312,7 +4310,7 @@ AlterExtensionContentsStmt: ...@@ -4312,7 +4310,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_LANGUAGE; n->objtype = OBJECT_LANGUAGE;
n->objname = list_make1(makeString($7)); n->object = (Node *) makeString($7);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes | ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes
...@@ -4321,8 +4319,7 @@ AlterExtensionContentsStmt: ...@@ -4321,8 +4319,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_OPERATOR; n->objtype = OBJECT_OPERATOR;
n->objname = $6->objname; n->object = (Node *) $6;
n->objargs = $6->objargs;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING access_method | ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING access_method
...@@ -4331,7 +4328,7 @@ AlterExtensionContentsStmt: ...@@ -4331,7 +4328,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_OPCLASS; n->objtype = OBJECT_OPCLASS;
n->objname = lcons(makeString($9), $7); n->object = (Node *) lcons(makeString($9), $7);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING access_method | ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING access_method
...@@ -4340,7 +4337,7 @@ AlterExtensionContentsStmt: ...@@ -4340,7 +4337,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_OPFAMILY; n->objtype = OBJECT_OPFAMILY;
n->objname = lcons(makeString($9), $7); n->object = (Node *) lcons(makeString($9), $7);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop SCHEMA name | ALTER EXTENSION name add_drop SCHEMA name
...@@ -4349,7 +4346,7 @@ AlterExtensionContentsStmt: ...@@ -4349,7 +4346,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_SCHEMA; n->objtype = OBJECT_SCHEMA;
n->objname = list_make1(makeString($6)); n->object = (Node *) makeString($6);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop EVENT TRIGGER name | ALTER EXTENSION name add_drop EVENT TRIGGER name
...@@ -4358,7 +4355,7 @@ AlterExtensionContentsStmt: ...@@ -4358,7 +4355,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_EVENT_TRIGGER; n->objtype = OBJECT_EVENT_TRIGGER;
n->objname = list_make1(makeString($7)); n->object = (Node *) makeString($7);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TABLE any_name | ALTER EXTENSION name add_drop TABLE any_name
...@@ -4367,7 +4364,7 @@ AlterExtensionContentsStmt: ...@@ -4367,7 +4364,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TABLE; n->objtype = OBJECT_TABLE;
n->objname = $6; n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TEXT_P SEARCH PARSER any_name | ALTER EXTENSION name add_drop TEXT_P SEARCH PARSER any_name
...@@ -4376,7 +4373,7 @@ AlterExtensionContentsStmt: ...@@ -4376,7 +4373,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TSPARSER; n->objtype = OBJECT_TSPARSER;
n->objname = $8; n->object = (Node *) $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TEXT_P SEARCH DICTIONARY any_name | ALTER EXTENSION name add_drop TEXT_P SEARCH DICTIONARY any_name
...@@ -4385,7 +4382,7 @@ AlterExtensionContentsStmt: ...@@ -4385,7 +4382,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TSDICTIONARY; n->objtype = OBJECT_TSDICTIONARY;
n->objname = $8; n->object = (Node *) $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TEXT_P SEARCH TEMPLATE any_name | ALTER EXTENSION name add_drop TEXT_P SEARCH TEMPLATE any_name
...@@ -4394,7 +4391,7 @@ AlterExtensionContentsStmt: ...@@ -4394,7 +4391,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TSTEMPLATE; n->objtype = OBJECT_TSTEMPLATE;
n->objname = $8; n->object = (Node *) $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TEXT_P SEARCH CONFIGURATION any_name | ALTER EXTENSION name add_drop TEXT_P SEARCH CONFIGURATION any_name
...@@ -4403,7 +4400,7 @@ AlterExtensionContentsStmt: ...@@ -4403,7 +4400,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TSCONFIGURATION; n->objtype = OBJECT_TSCONFIGURATION;
n->objname = $8; n->object = (Node *) $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop SEQUENCE any_name | ALTER EXTENSION name add_drop SEQUENCE any_name
...@@ -4412,7 +4409,7 @@ AlterExtensionContentsStmt: ...@@ -4412,7 +4409,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_SEQUENCE; n->objtype = OBJECT_SEQUENCE;
n->objname = $6; n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop VIEW any_name | ALTER EXTENSION name add_drop VIEW any_name
...@@ -4421,7 +4418,7 @@ AlterExtensionContentsStmt: ...@@ -4421,7 +4418,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_VIEW; n->objtype = OBJECT_VIEW;
n->objname = $6; n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop MATERIALIZED VIEW any_name | ALTER EXTENSION name add_drop MATERIALIZED VIEW any_name
...@@ -4430,7 +4427,7 @@ AlterExtensionContentsStmt: ...@@ -4430,7 +4427,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_MATVIEW; n->objtype = OBJECT_MATVIEW;
n->objname = $7; n->object = (Node *) $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop FOREIGN TABLE any_name | ALTER EXTENSION name add_drop FOREIGN TABLE any_name
...@@ -4439,7 +4436,7 @@ AlterExtensionContentsStmt: ...@@ -4439,7 +4436,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_FOREIGN_TABLE; n->objtype = OBJECT_FOREIGN_TABLE;
n->objname = $7; n->object = (Node *) $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop FOREIGN DATA_P WRAPPER name | ALTER EXTENSION name add_drop FOREIGN DATA_P WRAPPER name
...@@ -4448,7 +4445,7 @@ AlterExtensionContentsStmt: ...@@ -4448,7 +4445,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_FDW; n->objtype = OBJECT_FDW;
n->objname = list_make1(makeString($8)); n->object = (Node *) makeString($8);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop SERVER name | ALTER EXTENSION name add_drop SERVER name
...@@ -4457,7 +4454,7 @@ AlterExtensionContentsStmt: ...@@ -4457,7 +4454,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_FOREIGN_SERVER; n->objtype = OBJECT_FOREIGN_SERVER;
n->objname = list_make1(makeString($6)); n->object = (Node *) makeString($6);
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TRANSFORM FOR Typename LANGUAGE name | ALTER EXTENSION name add_drop TRANSFORM FOR Typename LANGUAGE name
...@@ -4466,8 +4463,7 @@ AlterExtensionContentsStmt: ...@@ -4466,8 +4463,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TRANSFORM; n->objtype = OBJECT_TRANSFORM;
n->objname = list_make1($7); n->object = (Node *) list_make2($7, makeString($9));
n->objargs = list_make1(makeString($9));
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION name add_drop TYPE_P Typename | ALTER EXTENSION name add_drop TYPE_P Typename
...@@ -4476,7 +4472,7 @@ AlterExtensionContentsStmt: ...@@ -4476,7 +4472,7 @@ AlterExtensionContentsStmt:
n->extname = $3; n->extname = $3;
n->action = $4; n->action = $4;
n->objtype = OBJECT_TYPE; n->objtype = OBJECT_TYPE;
n->objname = list_make1($6); n->object = (Node *) $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
; ;
...@@ -4526,8 +4522,7 @@ DropFdwStmt: DROP FOREIGN DATA_P WRAPPER name opt_drop_behavior ...@@ -4526,8 +4522,7 @@ DropFdwStmt: DROP FOREIGN DATA_P WRAPPER name opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FDW; n->removeType = OBJECT_FDW;
n->objects = list_make1(list_make1(makeString($5))); n->objects = list_make1(makeString($5));
n->arguments = NIL;
n->missing_ok = false; n->missing_ok = false;
n->behavior = $6; n->behavior = $6;
n->concurrent = false; n->concurrent = false;
...@@ -4537,8 +4532,7 @@ DropFdwStmt: DROP FOREIGN DATA_P WRAPPER name opt_drop_behavior ...@@ -4537,8 +4532,7 @@ DropFdwStmt: DROP FOREIGN DATA_P WRAPPER name opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FDW; n->removeType = OBJECT_FDW;
n->objects = list_make1(list_make1(makeString($7))); n->objects = list_make1(makeString($7));
n->arguments = NIL;
n->missing_ok = true; n->missing_ok = true;
n->behavior = $8; n->behavior = $8;
n->concurrent = false; n->concurrent = false;
...@@ -4688,8 +4682,7 @@ DropForeignServerStmt: DROP SERVER name opt_drop_behavior ...@@ -4688,8 +4682,7 @@ DropForeignServerStmt: DROP SERVER name opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FOREIGN_SERVER; n->removeType = OBJECT_FOREIGN_SERVER;
n->objects = list_make1(list_make1(makeString($3))); n->objects = list_make1(makeString($3));
n->arguments = NIL;
n->missing_ok = false; n->missing_ok = false;
n->behavior = $4; n->behavior = $4;
n->concurrent = false; n->concurrent = false;
...@@ -4699,8 +4692,7 @@ DropForeignServerStmt: DROP SERVER name opt_drop_behavior ...@@ -4699,8 +4692,7 @@ DropForeignServerStmt: DROP SERVER name opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FOREIGN_SERVER; n->removeType = OBJECT_FOREIGN_SERVER;
n->objects = list_make1(list_make1(makeString($5))); n->objects = list_make1(makeString($5));
n->arguments = NIL;
n->missing_ok = true; n->missing_ok = true;
n->behavior = $6; n->behavior = $6;
n->concurrent = false; n->concurrent = false;
...@@ -5024,7 +5016,6 @@ DropPolicyStmt: ...@@ -5024,7 +5016,6 @@ DropPolicyStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_POLICY; n->removeType = OBJECT_POLICY;
n->objects = list_make1(lappend($5, makeString($3))); n->objects = list_make1(lappend($5, makeString($3)));
n->arguments = NIL;
n->behavior = $6; n->behavior = $6;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -5035,7 +5026,6 @@ DropPolicyStmt: ...@@ -5035,7 +5026,6 @@ DropPolicyStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_POLICY; n->removeType = OBJECT_POLICY;
n->objects = list_make1(lappend($7, makeString($5))); n->objects = list_make1(lappend($7, makeString($5)));
n->arguments = NIL;
n->behavior = $8; n->behavior = $8;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -5348,7 +5338,6 @@ DropTrigStmt: ...@@ -5348,7 +5338,6 @@ DropTrigStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_TRIGGER; n->removeType = OBJECT_TRIGGER;
n->objects = list_make1(lappend($5, makeString($3))); n->objects = list_make1(lappend($5, makeString($3)));
n->arguments = NIL;
n->behavior = $6; n->behavior = $6;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -5359,7 +5348,6 @@ DropTrigStmt: ...@@ -5359,7 +5348,6 @@ DropTrigStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_TRIGGER; n->removeType = OBJECT_TRIGGER;
n->objects = list_make1(lappend($7, makeString($5))); n->objects = list_make1(lappend($7, makeString($5)));
n->arguments = NIL;
n->behavior = $8; n->behavior = $8;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -5469,7 +5457,6 @@ DropAssertStmt: ...@@ -5469,7 +5457,6 @@ DropAssertStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->objects = NIL; n->objects = NIL;
n->arguments = NIL;
n->behavior = $4; n->behavior = $4;
n->removeType = OBJECT_TRIGGER; /* XXX */ n->removeType = OBJECT_TRIGGER; /* XXX */
ereport(ERROR, ereport(ERROR,
...@@ -6008,24 +5995,42 @@ ReassignOwnedStmt: ...@@ -6008,24 +5995,42 @@ ReassignOwnedStmt:
* *
*****************************************************************************/ *****************************************************************************/
DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = $2; n->removeType = $2;
n->missing_ok = TRUE; n->missing_ok = TRUE;
n->objects = $5; n->objects = $5;
n->arguments = NIL;
n->behavior = $6; n->behavior = $6;
n->concurrent = false; n->concurrent = false;
$$ = (Node *)n; $$ = (Node *)n;
} }
| DROP drop_type any_name_list opt_drop_behavior | DROP drop_type_any_name any_name_list opt_drop_behavior
{
DropStmt *n = makeNode(DropStmt);
n->removeType = $2;
n->missing_ok = FALSE;
n->objects = $3;
n->behavior = $4;
n->concurrent = false;
$$ = (Node *)n;
}
| DROP drop_type_name IF_P EXISTS name_list opt_drop_behavior
{
DropStmt *n = makeNode(DropStmt);
n->removeType = $2;
n->missing_ok = TRUE;
n->objects = $5;
n->behavior = $6;
n->concurrent = false;
$$ = (Node *)n;
}
| DROP drop_type_name name_list opt_drop_behavior
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = $2; n->removeType = $2;
n->missing_ok = FALSE; n->missing_ok = FALSE;
n->objects = $3; n->objects = $3;
n->arguments = NIL;
n->behavior = $4; n->behavior = $4;
n->concurrent = false; n->concurrent = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -6076,7 +6081,6 @@ DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior ...@@ -6076,7 +6081,6 @@ DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior
n->removeType = OBJECT_INDEX; n->removeType = OBJECT_INDEX;
n->missing_ok = FALSE; n->missing_ok = FALSE;
n->objects = $4; n->objects = $4;
n->arguments = NIL;
n->behavior = $5; n->behavior = $5;
n->concurrent = true; n->concurrent = true;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -6087,31 +6091,35 @@ DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior ...@@ -6087,31 +6091,35 @@ DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior
n->removeType = OBJECT_INDEX; n->removeType = OBJECT_INDEX;
n->missing_ok = TRUE; n->missing_ok = TRUE;
n->objects = $6; n->objects = $6;
n->arguments = NIL;
n->behavior = $7; n->behavior = $7;
n->concurrent = true; n->concurrent = true;
$$ = (Node *)n; $$ = (Node *)n;
} }
; ;
/* object types taking any_name_list */
drop_type: TABLE { $$ = OBJECT_TABLE; } drop_type_any_name:
TABLE { $$ = OBJECT_TABLE; }
| SEQUENCE { $$ = OBJECT_SEQUENCE; } | SEQUENCE { $$ = OBJECT_SEQUENCE; }
| VIEW { $$ = OBJECT_VIEW; } | VIEW { $$ = OBJECT_VIEW; }
| MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; } | MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; }
| INDEX { $$ = OBJECT_INDEX; } | INDEX { $$ = OBJECT_INDEX; }
| FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; } | FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; }
| ACCESS METHOD { $$ = OBJECT_ACCESS_METHOD; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| COLLATION { $$ = OBJECT_COLLATION; } | COLLATION { $$ = OBJECT_COLLATION; }
| CONVERSION_P { $$ = OBJECT_CONVERSION; } | CONVERSION_P { $$ = OBJECT_CONVERSION; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
| EXTENSION { $$ = OBJECT_EXTENSION; }
| TEXT_P SEARCH PARSER { $$ = OBJECT_TSPARSER; } | TEXT_P SEARCH PARSER { $$ = OBJECT_TSPARSER; }
| TEXT_P SEARCH DICTIONARY { $$ = OBJECT_TSDICTIONARY; } | TEXT_P SEARCH DICTIONARY { $$ = OBJECT_TSDICTIONARY; }
| TEXT_P SEARCH TEMPLATE { $$ = OBJECT_TSTEMPLATE; } | TEXT_P SEARCH TEMPLATE { $$ = OBJECT_TSTEMPLATE; }
| TEXT_P SEARCH CONFIGURATION { $$ = OBJECT_TSCONFIGURATION; } | TEXT_P SEARCH CONFIGURATION { $$ = OBJECT_TSCONFIGURATION; }
;
/* object types taking name_list */
drop_type_name:
ACCESS METHOD { $$ = OBJECT_ACCESS_METHOD; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| EXTENSION { $$ = OBJECT_EXTENSION; }
| PUBLICATION { $$ = OBJECT_PUBLICATION; } | PUBLICATION { $$ = OBJECT_PUBLICATION; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
; ;
any_name_list: any_name_list:
...@@ -6130,8 +6138,8 @@ attrs: '.' attr_name ...@@ -6130,8 +6138,8 @@ attrs: '.' attr_name
; ;
type_name_list: type_name_list:
Typename { $$ = list_make1(list_make1($1)); } Typename { $$ = list_make1($1); }
| type_name_list ',' Typename { $$ = lappend($1, list_make1($3)); } | type_name_list ',' Typename { $$ = lappend($1, $3); }
/***************************************************************************** /*****************************************************************************
* *
...@@ -6188,12 +6196,19 @@ opt_restart_seqs: ...@@ -6188,12 +6196,19 @@ opt_restart_seqs:
*****************************************************************************/ *****************************************************************************/
CommentStmt: CommentStmt:
COMMENT ON comment_type any_name IS comment_text COMMENT ON comment_type_any_name any_name IS comment_text
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = $3; n->objtype = $3;
n->objname = $4; n->object = (Node *) $4;
n->objargs = NIL; n->comment = $6;
$$ = (Node *) n;
}
| COMMENT ON comment_type_name name IS comment_text
{
CommentStmt *n = makeNode(CommentStmt);
n->objtype = $3;
n->object = (Node *) makeString($4);
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6201,8 +6216,7 @@ CommentStmt: ...@@ -6201,8 +6216,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_TYPE; n->objtype = OBJECT_TYPE;
n->objname = list_make1($4); n->object = (Node *) $4;
n->objargs = NIL;
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6210,8 +6224,7 @@ CommentStmt: ...@@ -6210,8 +6224,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_DOMAIN; n->objtype = OBJECT_DOMAIN;
n->objname = list_make1($4); n->object = (Node *) $4;
n->objargs = NIL;
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6219,8 +6232,7 @@ CommentStmt: ...@@ -6219,8 +6232,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_AGGREGATE; n->objtype = OBJECT_AGGREGATE;
n->objname = $4->objname; n->object = (Node *) $4;
n->objargs = $4->objargs;
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6228,8 +6240,7 @@ CommentStmt: ...@@ -6228,8 +6240,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_FUNCTION; n->objtype = OBJECT_FUNCTION;
n->objname = $4->objname; n->object = (Node *) $4;
n->objargs = $4->objargs;
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6237,8 +6248,7 @@ CommentStmt: ...@@ -6237,8 +6248,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_OPERATOR; n->objtype = OBJECT_OPERATOR;
n->objname = $4->objname; n->object = (Node *) $4;
n->objargs = $4->objargs;
n->comment = $6; n->comment = $6;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6246,8 +6256,7 @@ CommentStmt: ...@@ -6246,8 +6256,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_TABCONSTRAINT; n->objtype = OBJECT_TABCONSTRAINT;
n->objname = lappend($6, makeString($4)); n->object = (Node *) lappend($6, makeString($4));
n->objargs = NIL;
n->comment = $8; n->comment = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6260,8 +6269,7 @@ CommentStmt: ...@@ -6260,8 +6269,7 @@ CommentStmt:
* there's a shift/reduce conflict if we do that, so fix it * there's a shift/reduce conflict if we do that, so fix it
* up here. * up here.
*/ */
n->objname = list_make1(makeTypeNameFromNameList($7)); n->object = (Node *) list_make2(makeTypeNameFromNameList($7), makeString($4));
n->objargs = list_make1(makeString($4));
n->comment = $9; n->comment = $9;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6269,8 +6277,7 @@ CommentStmt: ...@@ -6269,8 +6277,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_POLICY; n->objtype = OBJECT_POLICY;
n->objname = lappend($6, makeString($4)); n->object = (Node *) lappend($6, makeString($4));
n->objargs = NIL;
n->comment = $8; n->comment = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6278,8 +6285,7 @@ CommentStmt: ...@@ -6278,8 +6285,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_RULE; n->objtype = OBJECT_RULE;
n->objname = lappend($6, makeString($4)); n->object = (Node *) lappend($6, makeString($4));
n->objargs = NIL;
n->comment = $8; n->comment = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6287,8 +6293,7 @@ CommentStmt: ...@@ -6287,8 +6293,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_TRANSFORM; n->objtype = OBJECT_TRANSFORM;
n->objname = list_make1($5); n->object = (Node *) list_make2($5, makeString($7));
n->objargs = list_make1(makeString($7));
n->comment = $9; n->comment = $9;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6296,8 +6301,7 @@ CommentStmt: ...@@ -6296,8 +6301,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_TRIGGER; n->objtype = OBJECT_TRIGGER;
n->objname = lappend($6, makeString($4)); n->object = (Node *) lappend($6, makeString($4));
n->objargs = NIL;
n->comment = $8; n->comment = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6305,7 +6309,7 @@ CommentStmt: ...@@ -6305,7 +6309,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_OPCLASS; n->objtype = OBJECT_OPCLASS;
n->objname = lcons(makeString($7), $5); n->object = (Node *) lcons(makeString($7), $5);
n->comment = $9; n->comment = $9;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6313,8 +6317,7 @@ CommentStmt: ...@@ -6313,8 +6317,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_OPFAMILY; n->objtype = OBJECT_OPFAMILY;
n->objname = lcons(makeString($7), $5); n->object = (Node *) lcons(makeString($7), $5);
n->objargs = NIL;
n->comment = $9; n->comment = $9;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6322,8 +6325,7 @@ CommentStmt: ...@@ -6322,8 +6325,7 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_LARGEOBJECT; n->objtype = OBJECT_LARGEOBJECT;
n->objname = list_make1($5); n->object = (Node *) $5;
n->objargs = NIL;
n->comment = $7; n->comment = $7;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6331,27 +6333,15 @@ CommentStmt: ...@@ -6331,27 +6333,15 @@ CommentStmt:
{ {
CommentStmt *n = makeNode(CommentStmt); CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_CAST; n->objtype = OBJECT_CAST;
n->objname = list_make1($5); n->object = (Node *) list_make2($5, $7);
n->objargs = list_make1($7);
n->comment = $10; n->comment = $10;
$$ = (Node *) n; $$ = (Node *) n;
} }
| COMMENT ON opt_procedural LANGUAGE any_name IS comment_text
{
CommentStmt *n = makeNode(CommentStmt);
n->objtype = OBJECT_LANGUAGE;
n->objname = $5;
n->objargs = NIL;
n->comment = $7;
$$ = (Node *) n;
}
; ;
comment_type: /* object types taking any_name */
ACCESS METHOD { $$ = OBJECT_ACCESS_METHOD; } comment_type_any_name:
| COLUMN { $$ = OBJECT_COLUMN; } COLUMN { $$ = OBJECT_COLUMN; }
| DATABASE { $$ = OBJECT_DATABASE; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
| INDEX { $$ = OBJECT_INDEX; } | INDEX { $$ = OBJECT_INDEX; }
| SEQUENCE { $$ = OBJECT_SEQUENCE; } | SEQUENCE { $$ = OBJECT_SEQUENCE; }
| TABLE { $$ = OBJECT_TABLE; } | TABLE { $$ = OBJECT_TABLE; }
...@@ -6359,19 +6349,27 @@ comment_type: ...@@ -6359,19 +6349,27 @@ comment_type:
| MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; } | MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; }
| COLLATION { $$ = OBJECT_COLLATION; } | COLLATION { $$ = OBJECT_COLLATION; }
| CONVERSION_P { $$ = OBJECT_CONVERSION; } | CONVERSION_P { $$ = OBJECT_CONVERSION; }
| TABLESPACE { $$ = OBJECT_TABLESPACE; }
| EXTENSION { $$ = OBJECT_EXTENSION; }
| ROLE { $$ = OBJECT_ROLE; }
| FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; } | FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; }
| SERVER { $$ = OBJECT_FOREIGN_SERVER; }
| FOREIGN DATA_P WRAPPER { $$ = OBJECT_FDW; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| TEXT_P SEARCH CONFIGURATION { $$ = OBJECT_TSCONFIGURATION; } | TEXT_P SEARCH CONFIGURATION { $$ = OBJECT_TSCONFIGURATION; }
| TEXT_P SEARCH DICTIONARY { $$ = OBJECT_TSDICTIONARY; } | TEXT_P SEARCH DICTIONARY { $$ = OBJECT_TSDICTIONARY; }
| TEXT_P SEARCH PARSER { $$ = OBJECT_TSPARSER; } | TEXT_P SEARCH PARSER { $$ = OBJECT_TSPARSER; }
| TEXT_P SEARCH TEMPLATE { $$ = OBJECT_TSTEMPLATE; } | TEXT_P SEARCH TEMPLATE { $$ = OBJECT_TSTEMPLATE; }
; ;
/* object types taking name */
comment_type_name:
ACCESS METHOD { $$ = OBJECT_ACCESS_METHOD; }
| DATABASE { $$ = OBJECT_DATABASE; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| EXTENSION { $$ = OBJECT_EXTENSION; }
| FOREIGN DATA_P WRAPPER { $$ = OBJECT_FDW; }
| opt_procedural LANGUAGE { $$ = OBJECT_LANGUAGE; }
| ROLE { $$ = OBJECT_ROLE; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
| SERVER { $$ = OBJECT_FOREIGN_SERVER; }
| TABLESPACE { $$ = OBJECT_TABLESPACE; }
;
comment_text: comment_text:
Sconst { $$ = $1; } Sconst { $$ = $1; }
| NULL_P { $$ = NULL; } | NULL_P { $$ = NULL; }
...@@ -6388,14 +6386,23 @@ comment_text: ...@@ -6388,14 +6386,23 @@ comment_text:
*****************************************************************************/ *****************************************************************************/
SecLabelStmt: SecLabelStmt:
SECURITY LABEL opt_provider ON security_label_type any_name SECURITY LABEL opt_provider ON security_label_type_any_name any_name
IS security_label IS security_label
{ {
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = $5; n->objtype = $5;
n->objname = $6; n->object = (Node *) $6;
n->objargs = NIL; n->label = $8;
$$ = (Node *) n;
}
| SECURITY LABEL opt_provider ON security_label_type_name name
IS security_label
{
SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3;
n->objtype = $5;
n->object = (Node *) makeString($6);
n->label = $8; n->label = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6405,8 +6412,7 @@ SecLabelStmt: ...@@ -6405,8 +6412,7 @@ SecLabelStmt:
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = OBJECT_TYPE; n->objtype = OBJECT_TYPE;
n->objname = list_make1($6); n->object = (Node *) $6;
n->objargs = NIL;
n->label = $8; n->label = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6416,8 +6422,7 @@ SecLabelStmt: ...@@ -6416,8 +6422,7 @@ SecLabelStmt:
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = OBJECT_TYPE; n->objtype = OBJECT_TYPE;
n->objname = list_make1($6); n->object = (Node *) $6;
n->objargs = NIL;
n->label = $8; n->label = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6427,8 +6432,7 @@ SecLabelStmt: ...@@ -6427,8 +6432,7 @@ SecLabelStmt:
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = OBJECT_AGGREGATE; n->objtype = OBJECT_AGGREGATE;
n->objname = $6->objname; n->object = (Node *) $6;
n->objargs = $6->objargs;
n->label = $8; n->label = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6438,8 +6442,7 @@ SecLabelStmt: ...@@ -6438,8 +6442,7 @@ SecLabelStmt:
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = OBJECT_FUNCTION; n->objtype = OBJECT_FUNCTION;
n->objname = $6->objname; n->object = (Node *) $6;
n->objargs = $6->objargs;
n->label = $8; n->label = $8;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6449,19 +6452,7 @@ SecLabelStmt: ...@@ -6449,19 +6452,7 @@ SecLabelStmt:
SecLabelStmt *n = makeNode(SecLabelStmt); SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3; n->provider = $3;
n->objtype = OBJECT_LARGEOBJECT; n->objtype = OBJECT_LARGEOBJECT;
n->objname = list_make1($7); n->object = (Node *) $7;
n->objargs = NIL;
n->label = $9;
$$ = (Node *) n;
}
| SECURITY LABEL opt_provider ON opt_procedural LANGUAGE any_name
IS security_label
{
SecLabelStmt *n = makeNode(SecLabelStmt);
n->provider = $3;
n->objtype = OBJECT_LANGUAGE;
n->objname = $7;
n->objargs = NIL;
n->label = $9; n->label = $9;
$$ = (Node *) n; $$ = (Node *) n;
} }
...@@ -6471,20 +6462,26 @@ opt_provider: FOR NonReservedWord_or_Sconst { $$ = $2; } ...@@ -6471,20 +6462,26 @@ opt_provider: FOR NonReservedWord_or_Sconst { $$ = $2; }
| /* empty */ { $$ = NULL; } | /* empty */ { $$ = NULL; }
; ;
security_label_type: /* object types taking any_name */
security_label_type_any_name:
COLUMN { $$ = OBJECT_COLUMN; } COLUMN { $$ = OBJECT_COLUMN; }
| DATABASE { $$ = OBJECT_DATABASE; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; } | FOREIGN TABLE { $$ = OBJECT_FOREIGN_TABLE; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
| SEQUENCE { $$ = OBJECT_SEQUENCE; } | SEQUENCE { $$ = OBJECT_SEQUENCE; }
| TABLE { $$ = OBJECT_TABLE; } | TABLE { $$ = OBJECT_TABLE; }
| ROLE { $$ = OBJECT_ROLE; }
| TABLESPACE { $$ = OBJECT_TABLESPACE; }
| VIEW { $$ = OBJECT_VIEW; } | VIEW { $$ = OBJECT_VIEW; }
| MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; } | MATERIALIZED VIEW { $$ = OBJECT_MATVIEW; }
; ;
/* object types taking name */
security_label_type_name:
DATABASE { $$ = OBJECT_DATABASE; }
| EVENT TRIGGER { $$ = OBJECT_EVENT_TRIGGER; }
| opt_procedural LANGUAGE { $$ = OBJECT_LANGUAGE; }
| ROLE { $$ = OBJECT_ROLE; }
| SCHEMA { $$ = OBJECT_SCHEMA; }
| TABLESPACE { $$ = OBJECT_TABLESPACE; }
;
security_label: Sconst { $$ = $1; } security_label: Sconst { $$ = $1; }
| NULL_P { $$ = NULL; } | NULL_P { $$ = NULL; }
; ;
...@@ -7684,8 +7681,7 @@ RemoveFuncStmt: ...@@ -7684,8 +7681,7 @@ RemoveFuncStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FUNCTION; n->removeType = OBJECT_FUNCTION;
n->objects = list_make1($3->objname); n->objects = list_make1($3);
n->arguments = list_make1($3->objargs);
n->behavior = $4; n->behavior = $4;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -7695,8 +7691,7 @@ RemoveFuncStmt: ...@@ -7695,8 +7691,7 @@ RemoveFuncStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_FUNCTION; n->removeType = OBJECT_FUNCTION;
n->objects = list_make1($5->objname); n->objects = list_make1($5);
n->arguments = list_make1($5->objargs);
n->behavior = $6; n->behavior = $6;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -7709,8 +7704,7 @@ RemoveAggrStmt: ...@@ -7709,8 +7704,7 @@ RemoveAggrStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_AGGREGATE; n->removeType = OBJECT_AGGREGATE;
n->objects = list_make1($3->objname); n->objects = list_make1($3);
n->arguments = list_make1($3->objargs);
n->behavior = $4; n->behavior = $4;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -7720,8 +7714,7 @@ RemoveAggrStmt: ...@@ -7720,8 +7714,7 @@ RemoveAggrStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_AGGREGATE; n->removeType = OBJECT_AGGREGATE;
n->objects = list_make1($5->objname); n->objects = list_make1($5);
n->arguments = list_make1($5->objargs);
n->behavior = $6; n->behavior = $6;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -7734,8 +7727,7 @@ RemoveOperStmt: ...@@ -7734,8 +7727,7 @@ RemoveOperStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_OPERATOR; n->removeType = OBJECT_OPERATOR;
n->objects = list_make1($3->objname); n->objects = list_make1($3);
n->arguments = list_make1($3->objargs);
n->behavior = $4; n->behavior = $4;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -7745,8 +7737,7 @@ RemoveOperStmt: ...@@ -7745,8 +7737,7 @@ RemoveOperStmt:
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_OPERATOR; n->removeType = OBJECT_OPERATOR;
n->objects = list_make1($5->objname); n->objects = list_make1($5);
n->arguments = list_make1($5->objargs);
n->behavior = $6; n->behavior = $6;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
...@@ -7872,8 +7863,7 @@ DropCastStmt: DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_beha ...@@ -7872,8 +7863,7 @@ DropCastStmt: DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_beha
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_CAST; n->removeType = OBJECT_CAST;
n->objects = list_make1(list_make1($5)); n->objects = list_make1(list_make2($5, $7));
n->arguments = list_make1(list_make1($7));
n->behavior = $9; n->behavior = $9;
n->missing_ok = $3; n->missing_ok = $3;
n->concurrent = false; n->concurrent = false;
...@@ -7927,8 +7917,7 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d ...@@ -7927,8 +7917,7 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_TRANSFORM; n->removeType = OBJECT_TRANSFORM;
n->objects = list_make1(list_make1($5)); n->objects = list_make1(list_make2($5, makeString($7)));
n->arguments = list_make1(list_make1(makeString($7)));
n->behavior = $8; n->behavior = $8;
n->missing_ok = $3; n->missing_ok = $3;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8035,8 +8024,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8035,8 +8024,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_AGGREGATE; n->renameType = OBJECT_AGGREGATE;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8045,7 +8033,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8045,7 +8033,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_COLLATION; n->renameType = OBJECT_COLLATION;
n->object = $3; n->object = (Node *) $3;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8054,7 +8042,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8054,7 +8042,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_CONVERSION; n->renameType = OBJECT_CONVERSION;
n->object = $3; n->object = (Node *) $3;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8072,7 +8060,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8072,7 +8060,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_DOMAIN; n->renameType = OBJECT_DOMAIN;
n->object = $3; n->object = (Node *) $3;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8081,7 +8069,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8081,7 +8069,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_DOMCONSTRAINT; n->renameType = OBJECT_DOMCONSTRAINT;
n->object = $3; n->object = (Node *) $3;
n->subname = $6; n->subname = $6;
n->newname = $8; n->newname = $8;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8090,7 +8078,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8090,7 +8078,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_FDW; n->renameType = OBJECT_FDW;
n->object = list_make1(makeString($5)); n->object = (Node *) makeString($5);
n->newname = $8; n->newname = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8099,8 +8087,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8099,8 +8087,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_FUNCTION; n->renameType = OBJECT_FUNCTION;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8118,7 +8105,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8118,7 +8105,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_LANGUAGE; n->renameType = OBJECT_LANGUAGE;
n->object = list_make1(makeString($4)); n->object = (Node *) makeString($4);
n->newname = $7; n->newname = $7;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8127,7 +8114,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8127,7 +8114,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_OPCLASS; n->renameType = OBJECT_OPCLASS;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newname = $9; n->newname = $9;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8136,7 +8123,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8136,7 +8123,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_OPFAMILY; n->renameType = OBJECT_OPFAMILY;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newname = $9; n->newname = $9;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8165,7 +8152,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8165,7 +8152,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_PUBLICATION; n->renameType = OBJECT_PUBLICATION;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8183,7 +8170,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8183,7 +8170,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_FOREIGN_SERVER; n->renameType = OBJECT_FOREIGN_SERVER;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8192,7 +8179,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8192,7 +8179,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_SUBSCRIPTION; n->renameType = OBJECT_SUBSCRIPTION;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8427,7 +8414,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8427,7 +8414,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_EVENT_TRIGGER; n->renameType = OBJECT_EVENT_TRIGGER;
n->object = list_make1(makeString($4)); n->object = (Node *) makeString($4);
n->newname = $7; n->newname = $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8462,7 +8449,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8462,7 +8449,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_TSPARSER; n->renameType = OBJECT_TSPARSER;
n->object = $5; n->object = (Node *) $5;
n->newname = $8; n->newname = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8471,7 +8458,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8471,7 +8458,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_TSDICTIONARY; n->renameType = OBJECT_TSDICTIONARY;
n->object = $5; n->object = (Node *) $5;
n->newname = $8; n->newname = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8480,7 +8467,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8480,7 +8467,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_TSTEMPLATE; n->renameType = OBJECT_TSTEMPLATE;
n->object = $5; n->object = (Node *) $5;
n->newname = $8; n->newname = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8489,7 +8476,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8489,7 +8476,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_TSCONFIGURATION; n->renameType = OBJECT_TSCONFIGURATION;
n->object = $5; n->object = (Node *) $5;
n->newname = $8; n->newname = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8498,7 +8485,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name ...@@ -8498,7 +8485,7 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
{ {
RenameStmt *n = makeNode(RenameStmt); RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_TYPE; n->renameType = OBJECT_TYPE;
n->object = $3; n->object = (Node *) $3;
n->newname = $6; n->newname = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8536,9 +8523,7 @@ AlterObjectDependsStmt: ...@@ -8536,9 +8523,7 @@ AlterObjectDependsStmt:
{ {
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt); AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
n->objectType = OBJECT_FUNCTION; n->objectType = OBJECT_FUNCTION;
n->relation = NULL; n->object = (Node *) $3;
n->objname = $3->objname;
n->objargs = $3->objargs;
n->extname = makeString($7); n->extname = makeString($7);
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8547,8 +8532,7 @@ AlterObjectDependsStmt: ...@@ -8547,8 +8532,7 @@ AlterObjectDependsStmt:
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt); AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
n->objectType = OBJECT_TRIGGER; n->objectType = OBJECT_TRIGGER;
n->relation = $5; n->relation = $5;
n->objname = list_make1(makeString($3)); n->object = (Node *) list_make1(makeString($3));
n->objargs = NIL;
n->extname = makeString($9); n->extname = makeString($9);
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8557,8 +8541,6 @@ AlterObjectDependsStmt: ...@@ -8557,8 +8541,6 @@ AlterObjectDependsStmt:
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt); AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
n->objectType = OBJECT_MATVIEW; n->objectType = OBJECT_MATVIEW;
n->relation = $4; n->relation = $4;
n->objname = NIL;
n->objargs = NIL;
n->extname = makeString($8); n->extname = makeString($8);
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8567,8 +8549,6 @@ AlterObjectDependsStmt: ...@@ -8567,8 +8549,6 @@ AlterObjectDependsStmt:
AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt); AlterObjectDependsStmt *n = makeNode(AlterObjectDependsStmt);
n->objectType = OBJECT_INDEX; n->objectType = OBJECT_INDEX;
n->relation = $3; n->relation = $3;
n->objname = NIL;
n->objargs = NIL;
n->extname = makeString($7); n->extname = makeString($7);
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8585,8 +8565,7 @@ AlterObjectSchemaStmt: ...@@ -8585,8 +8565,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_AGGREGATE; n->objectType = OBJECT_AGGREGATE;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8595,7 +8574,7 @@ AlterObjectSchemaStmt: ...@@ -8595,7 +8574,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_COLLATION; n->objectType = OBJECT_COLLATION;
n->object = $3; n->object = (Node *) $3;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8604,7 +8583,7 @@ AlterObjectSchemaStmt: ...@@ -8604,7 +8583,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_CONVERSION; n->objectType = OBJECT_CONVERSION;
n->object = $3; n->object = (Node *) $3;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8613,16 +8592,16 @@ AlterObjectSchemaStmt: ...@@ -8613,16 +8592,16 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_DOMAIN; n->objectType = OBJECT_DOMAIN;
n->object = $3; n->object = (Node *) $3;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
} }
| ALTER EXTENSION any_name SET SCHEMA name | ALTER EXTENSION name SET SCHEMA name
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_EXTENSION; n->objectType = OBJECT_EXTENSION;
n->object = $3; n->object = (Node *) makeString($3);
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8631,8 +8610,7 @@ AlterObjectSchemaStmt: ...@@ -8631,8 +8610,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_FUNCTION; n->objectType = OBJECT_FUNCTION;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8641,8 +8619,7 @@ AlterObjectSchemaStmt: ...@@ -8641,8 +8619,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPERATOR; n->objectType = OBJECT_OPERATOR;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8651,7 +8628,7 @@ AlterObjectSchemaStmt: ...@@ -8651,7 +8628,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPCLASS; n->objectType = OBJECT_OPCLASS;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newschema = $9; n->newschema = $9;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8660,7 +8637,7 @@ AlterObjectSchemaStmt: ...@@ -8660,7 +8637,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_OPFAMILY; n->objectType = OBJECT_OPFAMILY;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newschema = $9; n->newschema = $9;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8687,7 +8664,7 @@ AlterObjectSchemaStmt: ...@@ -8687,7 +8664,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_TSPARSER; n->objectType = OBJECT_TSPARSER;
n->object = $5; n->object = (Node *) $5;
n->newschema = $8; n->newschema = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8696,7 +8673,7 @@ AlterObjectSchemaStmt: ...@@ -8696,7 +8673,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_TSDICTIONARY; n->objectType = OBJECT_TSDICTIONARY;
n->object = $5; n->object = (Node *) $5;
n->newschema = $8; n->newschema = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8705,7 +8682,7 @@ AlterObjectSchemaStmt: ...@@ -8705,7 +8682,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_TSTEMPLATE; n->objectType = OBJECT_TSTEMPLATE;
n->object = $5; n->object = (Node *) $5;
n->newschema = $8; n->newschema = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8714,7 +8691,7 @@ AlterObjectSchemaStmt: ...@@ -8714,7 +8691,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_TSCONFIGURATION; n->objectType = OBJECT_TSCONFIGURATION;
n->object = $5; n->object = (Node *) $5;
n->newschema = $8; n->newschema = $8;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8795,7 +8772,7 @@ AlterObjectSchemaStmt: ...@@ -8795,7 +8772,7 @@ AlterObjectSchemaStmt:
{ {
AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt); AlterObjectSchemaStmt *n = makeNode(AlterObjectSchemaStmt);
n->objectType = OBJECT_TYPE; n->objectType = OBJECT_TYPE;
n->object = $3; n->object = (Node *) $3;
n->newschema = $6; n->newschema = $6;
n->missing_ok = false; n->missing_ok = false;
$$ = (Node *)n; $$ = (Node *)n;
...@@ -8839,8 +8816,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8839,8 +8816,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_AGGREGATE; n->objectType = OBJECT_AGGREGATE;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8848,7 +8824,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8848,7 +8824,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_COLLATION; n->objectType = OBJECT_COLLATION;
n->object = $3; n->object = (Node *) $3;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8856,7 +8832,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8856,7 +8832,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_CONVERSION; n->objectType = OBJECT_CONVERSION;
n->object = $3; n->object = (Node *) $3;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8864,7 +8840,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8864,7 +8840,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_DATABASE; n->objectType = OBJECT_DATABASE;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8872,7 +8848,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8872,7 +8848,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_DOMAIN; n->objectType = OBJECT_DOMAIN;
n->object = $3; n->object = (Node *) $3;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8880,8 +8856,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8880,8 +8856,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_FUNCTION; n->objectType = OBJECT_FUNCTION;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8889,7 +8864,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8889,7 +8864,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_LANGUAGE; n->objectType = OBJECT_LANGUAGE;
n->object = list_make1(makeString($4)); n->object = (Node *) makeString($4);
n->newowner = $7; n->newowner = $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8897,7 +8872,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8897,7 +8872,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_LARGEOBJECT; n->objectType = OBJECT_LARGEOBJECT;
n->object = list_make1($4); n->object = (Node *) $4;
n->newowner = $7; n->newowner = $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8905,8 +8880,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8905,8 +8880,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_OPERATOR; n->objectType = OBJECT_OPERATOR;
n->object = $3->objname; n->object = (Node *) $3;
n->objarg = $3->objargs;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8914,7 +8888,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8914,7 +8888,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_OPCLASS; n->objectType = OBJECT_OPCLASS;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newowner = $9; n->newowner = $9;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8922,7 +8896,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8922,7 +8896,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_OPFAMILY; n->objectType = OBJECT_OPFAMILY;
n->object = lcons(makeString($6), $4); n->object = (Node *) lcons(makeString($6), $4);
n->newowner = $9; n->newowner = $9;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8930,7 +8904,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8930,7 +8904,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_SCHEMA; n->objectType = OBJECT_SCHEMA;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8938,7 +8912,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8938,7 +8912,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_TYPE; n->objectType = OBJECT_TYPE;
n->object = $3; n->object = (Node *) $3;
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8946,7 +8920,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8946,7 +8920,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_TABLESPACE; n->objectType = OBJECT_TABLESPACE;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8954,7 +8928,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8954,7 +8928,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_TSDICTIONARY; n->objectType = OBJECT_TSDICTIONARY;
n->object = $5; n->object = (Node *) $5;
n->newowner = $8; n->newowner = $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8962,7 +8936,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8962,7 +8936,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_TSCONFIGURATION; n->objectType = OBJECT_TSCONFIGURATION;
n->object = $5; n->object = (Node *) $5;
n->newowner = $8; n->newowner = $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8970,7 +8944,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8970,7 +8944,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_FDW; n->objectType = OBJECT_FDW;
n->object = list_make1(makeString($5)); n->object = (Node *) makeString($5);
n->newowner = $8; n->newowner = $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8978,7 +8952,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8978,7 +8952,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_FOREIGN_SERVER; n->objectType = OBJECT_FOREIGN_SERVER;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8986,7 +8960,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8986,7 +8960,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_EVENT_TRIGGER; n->objectType = OBJECT_EVENT_TRIGGER;
n->object = list_make1(makeString($4)); n->object = (Node *) makeString($4);
n->newowner = $7; n->newowner = $7;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -8994,7 +8968,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -8994,7 +8968,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_PUBLICATION; n->objectType = OBJECT_PUBLICATION;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -9002,7 +8976,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec ...@@ -9002,7 +8976,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
{ {
AlterOwnerStmt *n = makeNode(AlterOwnerStmt); AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
n->objectType = OBJECT_SUBSCRIPTION; n->objectType = OBJECT_SUBSCRIPTION;
n->object = list_make1(makeString($3)); n->object = (Node *) makeString($3);
n->newowner = $6; n->newowner = $6;
$$ = (Node *)n; $$ = (Node *)n;
} }
...@@ -9299,7 +9273,6 @@ DropRuleStmt: ...@@ -9299,7 +9273,6 @@ DropRuleStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_RULE; n->removeType = OBJECT_RULE;
n->objects = list_make1(lappend($5, makeString($3))); n->objects = list_make1(lappend($5, makeString($3)));
n->arguments = NIL;
n->behavior = $6; n->behavior = $6;
n->missing_ok = false; n->missing_ok = false;
n->concurrent = false; n->concurrent = false;
...@@ -9310,7 +9283,6 @@ DropRuleStmt: ...@@ -9310,7 +9283,6 @@ DropRuleStmt:
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = OBJECT_RULE; n->removeType = OBJECT_RULE;
n->objects = list_make1(lappend($7, makeString($5))); n->objects = list_make1(lappend($7, makeString($5)));
n->arguments = NIL;
n->behavior = $8; n->behavior = $8;
n->missing_ok = true; n->missing_ok = true;
n->concurrent = false; n->concurrent = false;
......
...@@ -947,10 +947,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla ...@@ -947,10 +947,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
CommentStmt *stmt = makeNode(CommentStmt); CommentStmt *stmt = makeNode(CommentStmt);
stmt->objtype = OBJECT_COLUMN; stmt->objtype = OBJECT_COLUMN;
stmt->objname = list_make3(makeString(cxt->relation->schemaname), stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname),
makeString(cxt->relation->relname), makeString(cxt->relation->relname),
makeString(def->colname)); makeString(def->colname));
stmt->objargs = NIL;
stmt->comment = comment; stmt->comment = comment;
cxt->alist = lappend(cxt->alist, stmt); cxt->alist = lappend(cxt->alist, stmt);
...@@ -1013,10 +1012,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla ...@@ -1013,10 +1012,9 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
CommentStmt *stmt = makeNode(CommentStmt); CommentStmt *stmt = makeNode(CommentStmt);
stmt->objtype = OBJECT_TABCONSTRAINT; stmt->objtype = OBJECT_TABCONSTRAINT;
stmt->objname = list_make3(makeString(cxt->relation->schemaname), stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname),
makeString(cxt->relation->relname), makeString(cxt->relation->relname),
makeString(n->conname)); makeString(n->conname));
stmt->objargs = NIL;
stmt->comment = comment; stmt->comment = comment;
cxt->alist = lappend(cxt->alist, stmt); cxt->alist = lappend(cxt->alist, stmt);
......
...@@ -40,17 +40,17 @@ extern const ObjectAddress InvalidObjectAddress; ...@@ -40,17 +40,17 @@ extern const ObjectAddress InvalidObjectAddress;
#define ObjectAddressSet(addr, class_id, object_id) \ #define ObjectAddressSet(addr, class_id, object_id) \
ObjectAddressSubSet(addr, class_id, object_id, 0) ObjectAddressSubSet(addr, class_id, object_id, 0)
extern ObjectAddress get_object_address(ObjectType objtype, List *objname, extern ObjectAddress get_object_address(ObjectType objtype, Node *object,
List *objargs, Relation *relp, Relation *relp,
LOCKMODE lockmode, bool missing_ok); LOCKMODE lockmode, bool missing_ok);
extern ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel, extern ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel,
List *objname, List *objargs, Relation *relp, List *object, Relation *relp,
LOCKMODE lockmode, bool missing_ok); LOCKMODE lockmode, bool missing_ok);
extern void check_object_ownership(Oid roleid, extern void check_object_ownership(Oid roleid,
ObjectType objtype, ObjectAddress address, ObjectType objtype, ObjectAddress address,
List *objname, List *objargs, Relation relation); Node *object, Relation relation);
extern Oid get_object_namespace(const ObjectAddress *address); extern Oid get_object_namespace(const ObjectAddress *address);
......
...@@ -48,7 +48,7 @@ extern ObjectAddress ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt * ...@@ -48,7 +48,7 @@ extern ObjectAddress ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *
extern Oid get_extension_oid(const char *extname, bool missing_ok); extern Oid get_extension_oid(const char *extname, bool missing_ok);
extern char *get_extension_name(Oid ext_oid); extern char *get_extension_name(Oid ext_oid);
extern ObjectAddress AlterExtensionNamespace(List *names, const char *newschema, extern ObjectAddress AlterExtensionNamespace(const char *extensionName, const char *newschema,
Oid *oldschema); Oid *oldschema);
extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId); extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId);
......
...@@ -2076,8 +2076,7 @@ typedef struct AlterExtensionContentsStmt ...@@ -2076,8 +2076,7 @@ typedef struct AlterExtensionContentsStmt
char *extname; /* Extension's name */ char *extname; /* Extension's name */
int action; /* +1 = add object, -1 = drop object */ int action; /* +1 = add object, -1 = drop object */
ObjectType objtype; /* Object's type */ ObjectType objtype; /* Object's type */
List *objname; /* Qualified name of the object */ Node *object; /* Qualified name of the object */
List *objargs; /* Arguments if needed (eg, for functions) */
} AlterExtensionContentsStmt; } AlterExtensionContentsStmt;
/* ---------------------- /* ----------------------
...@@ -2462,8 +2461,7 @@ typedef struct AlterOpFamilyStmt ...@@ -2462,8 +2461,7 @@ typedef struct AlterOpFamilyStmt
typedef struct DropStmt typedef struct DropStmt
{ {
NodeTag type; NodeTag type;
List *objects; /* list of sublists of names (as Values) */ List *objects; /* list of names */
List *arguments; /* list of sublists of arguments (as Values) */
ObjectType removeType; /* object type */ ObjectType removeType; /* object type */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */ DropBehavior behavior; /* RESTRICT or CASCADE behavior */
bool missing_ok; /* skip error if object is missing? */ bool missing_ok; /* skip error if object is missing? */
...@@ -2490,8 +2488,7 @@ typedef struct CommentStmt ...@@ -2490,8 +2488,7 @@ typedef struct CommentStmt
{ {
NodeTag type; NodeTag type;
ObjectType objtype; /* Object's type */ ObjectType objtype; /* Object's type */
List *objname; /* Qualified name of the object */ Node *object; /* Qualified name of the object */
List *objargs; /* Arguments if needed (eg, for functions) */
char *comment; /* Comment to insert, or NULL to remove */ char *comment; /* Comment to insert, or NULL to remove */
} CommentStmt; } CommentStmt;
...@@ -2503,8 +2500,7 @@ typedef struct SecLabelStmt ...@@ -2503,8 +2500,7 @@ typedef struct SecLabelStmt
{ {
NodeTag type; NodeTag type;
ObjectType objtype; /* Object's type */ ObjectType objtype; /* Object's type */
List *objname; /* Qualified name of the object */ Node *object; /* Qualified name of the object */
List *objargs; /* Arguments if needed (eg, for functions) */
char *provider; /* Label provider (or NULL) */ char *provider; /* Label provider (or NULL) */
char *label; /* New security label to be assigned */ char *label; /* New security label to be assigned */
} SecLabelStmt; } SecLabelStmt;
...@@ -2678,8 +2674,7 @@ typedef struct RenameStmt ...@@ -2678,8 +2674,7 @@ typedef struct RenameStmt
ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */ ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */
ObjectType relationType; /* if column name, associated relation type */ ObjectType relationType; /* if column name, associated relation type */
RangeVar *relation; /* in case it's a table */ RangeVar *relation; /* in case it's a table */
List *object; /* in case it's some other object */ Node *object; /* in case it's some other object */
List *objarg; /* argument types, if applicable */
char *subname; /* name of contained object (column, rule, char *subname; /* name of contained object (column, rule,
* trigger, etc) */ * trigger, etc) */
char *newname; /* the new name */ char *newname; /* the new name */
...@@ -2696,8 +2691,7 @@ typedef struct AlterObjectDependsStmt ...@@ -2696,8 +2691,7 @@ typedef struct AlterObjectDependsStmt
NodeTag type; NodeTag type;
ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */ ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
RangeVar *relation; /* in case a table is involved */ RangeVar *relation; /* in case a table is involved */
List *objname; /* name of the object */ Node *object; /* name of the object */
List *objargs; /* argument types, if applicable */
Value *extname; /* extension name */ Value *extname; /* extension name */
} AlterObjectDependsStmt; } AlterObjectDependsStmt;
...@@ -2710,8 +2704,7 @@ typedef struct AlterObjectSchemaStmt ...@@ -2710,8 +2704,7 @@ typedef struct AlterObjectSchemaStmt
NodeTag type; NodeTag type;
ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
RangeVar *relation; /* in case it's a table */ RangeVar *relation; /* in case it's a table */
List *object; /* in case it's some other object */ Node *object; /* in case it's some other object */
List *objarg; /* argument types, if applicable */
char *newschema; /* the new schema */ char *newschema; /* the new schema */
bool missing_ok; /* skip error if missing? */ bool missing_ok; /* skip error if missing? */
} AlterObjectSchemaStmt; } AlterObjectSchemaStmt;
...@@ -2725,8 +2718,7 @@ typedef struct AlterOwnerStmt ...@@ -2725,8 +2718,7 @@ typedef struct AlterOwnerStmt
NodeTag type; NodeTag type;
ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */ ObjectType objectType; /* OBJECT_TABLE, OBJECT_TYPE, etc */
RangeVar *relation; /* in case it's a table */ RangeVar *relation; /* in case it's a table */
List *object; /* in case it's some other object */ Node *object; /* in case it's some other object */
List *objarg; /* argument types, if applicable */
RoleSpec *newowner; /* the new owner */ RoleSpec *newowner; /* the new owner */
} AlterOwnerStmt; } AlterOwnerStmt;
......
...@@ -80,9 +80,6 @@ create event trigger regress_event_trigger2 on ddl_command_start ...@@ -80,9 +80,6 @@ create event trigger regress_event_trigger2 on ddl_command_start
execute procedure test_event_trigger(); execute procedure test_event_trigger();
-- OK -- OK
comment on event trigger regress_event_trigger is 'test comment'; comment on event trigger regress_event_trigger is 'test comment';
-- should fail, event triggers are not schema objects
comment on event trigger wrong.regress_event_trigger is 'test comment';
ERROR: event trigger name cannot be qualified
-- drop as non-superuser should fail -- drop as non-superuser should fail
create role regress_evt_user; create role regress_evt_user;
set role regress_evt_user; set role regress_evt_user;
......
...@@ -296,7 +296,7 @@ WARNING: error for publication relation,{eins,zwei,drei},{integer}: cross-datab ...@@ -296,7 +296,7 @@ WARNING: error for publication relation,{eins,zwei,drei},{integer}: cross-datab
SELECT pg_get_object_address('language', '{one}', '{}'); SELECT pg_get_object_address('language', '{one}', '{}');
ERROR: language "one" does not exist ERROR: language "one" does not exist
SELECT pg_get_object_address('language', '{one,two}', '{}'); SELECT pg_get_object_address('language', '{one,two}', '{}');
ERROR: language name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('large object', '{123}', '{}'); SELECT pg_get_object_address('large object', '{123}', '{}');
ERROR: large object 123 does not exist ERROR: large object 123 does not exist
SELECT pg_get_object_address('large object', '{123,456}', '{}'); SELECT pg_get_object_address('large object', '{123,456}', '{}');
...@@ -306,47 +306,47 @@ ERROR: invalid input syntax for type oid: "blargh" ...@@ -306,47 +306,47 @@ ERROR: invalid input syntax for type oid: "blargh"
SELECT pg_get_object_address('schema', '{one}', '{}'); SELECT pg_get_object_address('schema', '{one}', '{}');
ERROR: schema "one" does not exist ERROR: schema "one" does not exist
SELECT pg_get_object_address('schema', '{one,two}', '{}'); SELECT pg_get_object_address('schema', '{one,two}', '{}');
ERROR: schema name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('role', '{one}', '{}'); SELECT pg_get_object_address('role', '{one}', '{}');
ERROR: role "one" does not exist ERROR: role "one" does not exist
SELECT pg_get_object_address('role', '{one,two}', '{}'); SELECT pg_get_object_address('role', '{one,two}', '{}');
ERROR: role name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('database', '{one}', '{}'); SELECT pg_get_object_address('database', '{one}', '{}');
ERROR: database "one" does not exist ERROR: database "one" does not exist
SELECT pg_get_object_address('database', '{one,two}', '{}'); SELECT pg_get_object_address('database', '{one,two}', '{}');
ERROR: database name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('tablespace', '{one}', '{}'); SELECT pg_get_object_address('tablespace', '{one}', '{}');
ERROR: tablespace "one" does not exist ERROR: tablespace "one" does not exist
SELECT pg_get_object_address('tablespace', '{one,two}', '{}'); SELECT pg_get_object_address('tablespace', '{one,two}', '{}');
ERROR: tablespace name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('foreign-data wrapper', '{one}', '{}'); SELECT pg_get_object_address('foreign-data wrapper', '{one}', '{}');
ERROR: foreign-data wrapper "one" does not exist ERROR: foreign-data wrapper "one" does not exist
SELECT pg_get_object_address('foreign-data wrapper', '{one,two}', '{}'); SELECT pg_get_object_address('foreign-data wrapper', '{one,two}', '{}');
ERROR: foreign-data wrapper name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('server', '{one}', '{}'); SELECT pg_get_object_address('server', '{one}', '{}');
ERROR: server "one" does not exist ERROR: server "one" does not exist
SELECT pg_get_object_address('server', '{one,two}', '{}'); SELECT pg_get_object_address('server', '{one,two}', '{}');
ERROR: server name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('extension', '{one}', '{}'); SELECT pg_get_object_address('extension', '{one}', '{}');
ERROR: extension "one" does not exist ERROR: extension "one" does not exist
SELECT pg_get_object_address('extension', '{one,two}', '{}'); SELECT pg_get_object_address('extension', '{one,two}', '{}');
ERROR: extension name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('event trigger', '{one}', '{}'); SELECT pg_get_object_address('event trigger', '{one}', '{}');
ERROR: event trigger "one" does not exist ERROR: event trigger "one" does not exist
SELECT pg_get_object_address('event trigger', '{one,two}', '{}'); SELECT pg_get_object_address('event trigger', '{one,two}', '{}');
ERROR: event trigger name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('access method', '{one}', '{}'); SELECT pg_get_object_address('access method', '{one}', '{}');
ERROR: access method "one" does not exist ERROR: access method "one" does not exist
SELECT pg_get_object_address('access method', '{one,two}', '{}'); SELECT pg_get_object_address('access method', '{one,two}', '{}');
ERROR: access method name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('publication', '{one}', '{}'); SELECT pg_get_object_address('publication', '{one}', '{}');
ERROR: publication "one" does not exist ERROR: publication "one" does not exist
SELECT pg_get_object_address('publication', '{one,two}', '{}'); SELECT pg_get_object_address('publication', '{one,two}', '{}');
ERROR: publication name cannot be qualified ERROR: name list length must be exactly 1
SELECT pg_get_object_address('subscription', '{one}', '{}'); SELECT pg_get_object_address('subscription', '{one}', '{}');
ERROR: subscription "one" does not exist ERROR: subscription "one" does not exist
SELECT pg_get_object_address('subscription', '{one,two}', '{}'); SELECT pg_get_object_address('subscription', '{one,two}', '{}');
ERROR: subscription name cannot be qualified ERROR: name list length must be exactly 1
-- test successful cases -- test successful cases
WITH objects (type, name, args) AS (VALUES WITH objects (type, name, args) AS (VALUES
('table', '{addr_nsp, gentable}'::text[], '{}'::text[]), ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]),
......
...@@ -82,9 +82,6 @@ create event trigger regress_event_trigger2 on ddl_command_start ...@@ -82,9 +82,6 @@ create event trigger regress_event_trigger2 on ddl_command_start
-- OK -- OK
comment on event trigger regress_event_trigger is 'test comment'; comment on event trigger regress_event_trigger is 'test comment';
-- should fail, event triggers are not schema objects
comment on event trigger wrong.regress_event_trigger is 'test comment';
-- drop as non-superuser should fail -- drop as non-superuser should fail
create role regress_evt_user; create role regress_evt_user;
set role regress_evt_user; set role regress_evt_user;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment