*
* If the object is a relation or a child object of a relation (e.g. an
* attribute or constraint), the relation is also opened and *relp receives
- * the open relcache entry pointer; otherwise, *relp is set to NULL. This
+ * the open relcache entry pointer; otherwise, *relp is set to NULL.
+ * (relp can be NULL if the caller never passes a relation-related object.) This
* is a bit grotty but it makes life simpler, since the caller will
* typically need the relcache entry too. Caller must close the relcache
* entry when done with it. The relation is locked with the specified lockmode
old_address = address;
}
+ /* relp must be given if it's a relation */
+ Assert(!relation || relp);
+
/* Return the object address and the relation. */
- *relp = relation;
+ if (relp)
+ *relp = relation;
return address;
}
{
ObjectAddress address;
Relation catalog;
- Relation relation;
address = get_object_address(stmt->renameType,
stmt->object,
- &relation,
+ NULL,
AccessExclusiveLock, false);
- Assert(relation == NULL);
catalog = table_open(address.classId, RowExclusiveLock);
AlterObjectRename_internal(catalog,
table_close(rel, NoLock);
refAddr = get_object_address(OBJECT_EXTENSION, (Node *) stmt->extname,
- &rel, AccessExclusiveLock, false);
- Assert(rel == NULL);
+ NULL, AccessExclusiveLock, false);
if (refAddress)
*refAddress = refAddr;
case OBJECT_TSTEMPLATE:
{
Relation catalog;
- Relation relation;
Oid classId;
Oid nspOid;
address = get_object_address(stmt->objectType,
stmt->object,
- &relation,
+ NULL,
AccessExclusiveLock,
false);
- Assert(relation == NULL);
classId = address.classId;
catalog = table_open(classId, RowExclusiveLock);
nspOid = LookupCreationNamespace(stmt->newschema);
case OBJECT_TSDICTIONARY:
case OBJECT_TSCONFIGURATION:
{
- Relation relation;
ObjectAddress address;
address = get_object_address(stmt->objectType,
stmt->object,
- &relation,
+ NULL,
AccessExclusiveLock,
false);
- Assert(relation == NULL);
AlterObjectOwner_internal(address.classId, address.objectId,
newowner);