1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

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
This commit is contained in:
Andres Freund
2019-01-21 10:32:19 -08:00
parent 111944c5ee
commit e0c4ec0728
114 changed files with 1259 additions and 1259 deletions

View File

@@ -95,7 +95,7 @@ CreateConstraintEntry(const char *constraintName,
int i;
ObjectAddress conobject;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
Assert(constraintName);
namestrcpy(&cname, constraintName);
@@ -230,7 +230,7 @@ CreateConstraintEntry(const char *constraintName,
conobject.objectId = conOid;
conobject.objectSubId = 0;
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
if (OidIsValid(relId))
{
@@ -394,7 +394,7 @@ ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
SysScanDesc conscan;
ScanKeyData skey[3];
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -418,7 +418,7 @@ ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
found = (HeapTupleIsValid(systable_getnext(conscan)));
systable_endscan(conscan);
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return found;
}
@@ -438,7 +438,7 @@ ConstraintNameExists(const char *conname, Oid namespaceid)
SysScanDesc conscan;
ScanKeyData skey[2];
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conname,
@@ -456,7 +456,7 @@ ConstraintNameExists(const char *conname, Oid namespaceid)
found = (HeapTupleIsValid(systable_getnext(conscan)));
systable_endscan(conscan);
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return found;
}
@@ -498,7 +498,7 @@ ChooseConstraintName(const char *name1, const char *name2,
bool found;
ListCell *l;
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
/* try the unmodified label first */
StrNCpy(modlabel, label, sizeof(modlabel));
@@ -546,7 +546,7 @@ ChooseConstraintName(const char *name1, const char *name2,
snprintf(modlabel, sizeof(modlabel), "%s%d", label, ++pass);
}
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return conname;
}
@@ -561,7 +561,7 @@ RemoveConstraintById(Oid conId)
HeapTuple tup;
Form_pg_constraint con;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tup)) /* should not happen */
@@ -579,7 +579,7 @@ RemoveConstraintById(Oid conId)
* If the constraint is for a relation, open and exclusive-lock the
* relation it's for.
*/
rel = heap_open(con->conrelid, AccessExclusiveLock);
rel = table_open(con->conrelid, AccessExclusiveLock);
/*
* We need to update the relcheck count if it is a check constraint
@@ -592,7 +592,7 @@ RemoveConstraintById(Oid conId)
HeapTuple relTup;
Form_pg_class classForm;
pgrel = heap_open(RelationRelationId, RowExclusiveLock);
pgrel = table_open(RelationRelationId, RowExclusiveLock);
relTup = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(con->conrelid));
if (!HeapTupleIsValid(relTup))
@@ -609,11 +609,11 @@ RemoveConstraintById(Oid conId)
heap_freetuple(relTup);
heap_close(pgrel, RowExclusiveLock);
table_close(pgrel, RowExclusiveLock);
}
/* Keep lock on constraint's rel until end of xact */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
else if (OidIsValid(con->contypid))
{
@@ -632,7 +632,7 @@ RemoveConstraintById(Oid conId)
/* Clean up */
ReleaseSysCache(tup);
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
}
/*
@@ -652,7 +652,7 @@ RenameConstraintById(Oid conId, const char *newname)
HeapTuple tuple;
Form_pg_constraint con;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tuple))
@@ -687,7 +687,7 @@ RenameConstraintById(Oid conId, const char *newname)
InvokeObjectPostAlterHook(ConstraintRelationId, conId, 0);
heap_freetuple(tuple);
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
}
/*
@@ -706,7 +706,7 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
SysScanDesc scan;
HeapTuple tup;
conRel = heap_open(ConstraintRelationId, RowExclusiveLock);
conRel = table_open(ConstraintRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_constraint_conrelid,
@@ -756,7 +756,7 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
systable_endscan(scan);
heap_close(conRel, RowExclusiveLock);
table_close(conRel, RowExclusiveLock);
}
/*
@@ -776,7 +776,7 @@ ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId)
ObjectAddress depender;
ObjectAddress referenced;
constrRel = heap_open(ConstraintRelationId, RowExclusiveLock);
constrRel = table_open(ConstraintRelationId, RowExclusiveLock);
tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(childConstrId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", childConstrId);
@@ -809,7 +809,7 @@ ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId)
}
ReleaseSysCache(tuple);
heap_close(constrRel, RowExclusiveLock);
table_close(constrRel, RowExclusiveLock);
}
@@ -827,7 +827,7 @@ get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
ScanKeyData skey[3];
Oid conOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -858,7 +858,7 @@ get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
errmsg("constraint \"%s\" for table \"%s\" does not exist",
conname, get_rel_name(relid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conOid;
}
@@ -888,7 +888,7 @@ get_relation_constraint_attnos(Oid relid, const char *conname,
/* Set *constraintOid, to avoid complaints about uninitialized vars */
*constraintOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -951,7 +951,7 @@ get_relation_constraint_attnos(Oid relid, const char *conname,
errmsg("constraint \"%s\" for table \"%s\" does not exist",
conname, get_rel_name(relid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conattnos;
}
@@ -969,7 +969,7 @@ get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
HeapTuple tuple;
Oid constraintId = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&key,
Anum_pg_constraint_conrelid,
@@ -991,7 +991,7 @@ get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
}
systable_endscan(scan);
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return constraintId;
}
@@ -1009,7 +1009,7 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
ScanKeyData skey[3];
Oid conOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -1040,7 +1040,7 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
errmsg("constraint \"%s\" for domain %s does not exist",
conname, format_type_be(typid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conOid;
}
@@ -1072,7 +1072,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
*constraintOid = InvalidOid;
/* Scan pg_constraint for constraints of the target rel */
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@@ -1133,7 +1133,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
systable_endscan(scan);
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return pkattnos;
}