aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2019-01-21 10:32:19 -0800
committerAndres Freund <andres@anarazel.de>2019-01-21 10:51:37 -0800
commite0c4ec07284db817e1f8d9adfb3fffc952252db0 (patch)
treead56d635b246f6d4d0d7a17b2a4ac797d7227b62 /src/backend/commands/typecmds.c
parent111944c5ee567f1c45bf0f1ecfdec682af467aa6 (diff)
downloadpostgresql-e0c4ec07284db817e1f8d9adfb3fffc952252db0.tar.gz
postgresql-e0c4ec07284db817e1f8d9adfb3fffc952252db0.zip
Replace uses of heap_open et al with the corresponding table_* function.
Author: Andres Freund Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 9ca30b0443c..35a6485118f 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -691,7 +691,7 @@ RemoveTypeById(Oid typeOid)
Relation relation;
HeapTuple tup;
- relation = heap_open(TypeRelationId, RowExclusiveLock);
+ relation = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@@ -717,7 +717,7 @@ RemoveTypeById(Oid typeOid)
ReleaseSysCache(tup);
- heap_close(relation, RowExclusiveLock);
+ table_close(relation, RowExclusiveLock);
}
@@ -2091,11 +2091,11 @@ AssignTypeArrayOid(void)
}
else
{
- Relation pg_type = heap_open(TypeRelationId, AccessShareLock);
+ Relation pg_type = table_open(TypeRelationId, AccessShareLock);
type_array_oid = GetNewOidWithIndex(pg_type, TypeOidIndexId,
Anum_pg_type_oid);
- heap_close(pg_type, AccessShareLock);
+ table_close(pg_type, AccessShareLock);
}
return type_array_oid;
@@ -2198,7 +2198,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@@ -2300,7 +2300,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
heap_freetuple(newtuple);
return address;
@@ -2328,7 +2328,7 @@ AlterDomainNotNull(List *names, bool notNull)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
- typrel = heap_open(TypeRelationId, RowExclusiveLock);
+ typrel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@@ -2341,7 +2341,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Is the domain already set to the desired constraint? */
if (typTup->typnotnull == notNull)
{
- heap_close(typrel, RowExclusiveLock);
+ table_close(typrel, RowExclusiveLock);
return address;
}
@@ -2401,7 +2401,7 @@ AlterDomainNotNull(List *names, bool notNull)
UnregisterSnapshot(snapshot);
/* Close each rel after processing, but keep lock */
- heap_close(testrel, NoLock);
+ table_close(testrel, NoLock);
}
}
@@ -2419,7 +2419,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Clean up */
heap_freetuple(tup);
- heap_close(typrel, RowExclusiveLock);
+ table_close(typrel, RowExclusiveLock);
return address;
}
@@ -2451,7 +2451,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@@ -2461,7 +2461,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
checkDomainOwner(tup);
/* Grab an appropriate lock on the pg_constraint relation */
- conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
+ conrel = table_open(ConstraintRelationId, RowExclusiveLock);
/* Find and remove the target constraint */
ScanKeyInit(&skey[0],
@@ -2495,7 +2495,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
/* Clean up after the scan */
systable_endscan(conscan);
- heap_close(conrel, RowExclusiveLock);
+ table_close(conrel, RowExclusiveLock);
if (!found)
{
@@ -2520,7 +2520,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
return address;
}
@@ -2548,7 +2548,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
- typrel = heap_open(TypeRelationId, RowExclusiveLock);
+ typrel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@@ -2636,7 +2636,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
- heap_close(typrel, RowExclusiveLock);
+ table_close(typrel, RowExclusiveLock);
return address;
}
@@ -2670,7 +2670,7 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
- typrel = heap_open(TypeRelationId, AccessShareLock);
+ typrel = table_open(TypeRelationId, AccessShareLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@@ -2682,7 +2682,7 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
/*
* Find and check the target constraint
*/
- conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
+ conrel = table_open(ConstraintRelationId, RowExclusiveLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -2740,8 +2740,8 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
systable_endscan(scan);
- heap_close(typrel, AccessShareLock);
- heap_close(conrel, RowExclusiveLock);
+ table_close(typrel, AccessShareLock);
+ table_close(conrel, RowExclusiveLock);
ReleaseSysCache(tup);
@@ -2829,7 +2829,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin)
UnregisterSnapshot(snapshot);
/* Hold relation lock till commit (XXX bad for concurrency) */
- heap_close(testrel, NoLock);
+ table_close(testrel, NoLock);
}
FreeExecutorState(estate);
@@ -2885,7 +2885,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
* We scan pg_depend to find those things that depend on the domain. (We
* assume we can ignore refobjsubid for a domain.)
*/
- depRel = heap_open(DependRelationId, AccessShareLock);
+ depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
@@ -3227,7 +3227,7 @@ RenameType(RenameStmt *stmt)
typeOid = typenameTypeId(NULL, typename);
/* Look up the type in the type table */
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@@ -3280,7 +3280,7 @@ RenameType(RenameStmt *stmt)
ObjectAddressSet(address, TypeRelationId, typeOid);
/* Clean up */
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
return address;
}
@@ -3300,7 +3300,7 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
AclResult aclresult;
ObjectAddress address;
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
/* Make a TypeName so we can use standard type lookup machinery */
typename = makeTypeNameFromNameList(names);
@@ -3381,7 +3381,7 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
ObjectAddressSet(address, TypeRelationId, typeOid);
/* Clean up */
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
return address;
}
@@ -3404,7 +3404,7 @@ AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
HeapTuple tup;
Form_pg_type typTup;
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@@ -3428,7 +3428,7 @@ AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
InvokeObjectPostAlterHook(TypeRelationId, typeOid, 0);
ReleaseSysCache(tup);
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
}
/*
@@ -3450,7 +3450,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
Datum aclDatum;
bool isNull;
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@@ -3486,7 +3486,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
AlterTypeOwnerInternal(typTup->typarray, newOwnerId);
/* Clean up */
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
}
/*
@@ -3591,7 +3591,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
if (object_address_present(&thisobj, objsMoved))
return InvalidOid;
- rel = heap_open(TypeRelationId, RowExclusiveLock);
+ rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@@ -3652,13 +3652,13 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
{
Relation classRel;
- classRel = heap_open(RelationRelationId, RowExclusiveLock);
+ classRel = table_open(RelationRelationId, RowExclusiveLock);
AlterRelationNamespaceInternal(classRel, typform->typrelid,
oldNspOid, nspOid,
false, objsMoved);
- heap_close(classRel, RowExclusiveLock);
+ table_close(classRel, RowExclusiveLock);
/*
* Check for constraints associated with the composite type (we don't
@@ -3691,7 +3691,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
heap_freetuple(tup);
- heap_close(rel, RowExclusiveLock);
+ table_close(rel, RowExclusiveLock);
add_exact_object_address(&thisobj, objsMoved);