mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +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:
@@ -80,7 +80,7 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
|
||||
oidarr = (Oid *) palloc(maxoids * sizeof(Oid));
|
||||
numoids = 0;
|
||||
|
||||
relation = heap_open(InheritsRelationId, AccessShareLock);
|
||||
relation = table_open(InheritsRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_inherits_inhparent,
|
||||
@@ -103,7 +103,7 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
|
||||
|
||||
systable_endscan(scan);
|
||||
|
||||
heap_close(relation, AccessShareLock);
|
||||
table_close(relation, AccessShareLock);
|
||||
|
||||
/*
|
||||
* If we found more than one child, sort them by OID. This ensures
|
||||
@@ -285,14 +285,14 @@ has_superclass(Oid relationId)
|
||||
ScanKeyData skey;
|
||||
bool result;
|
||||
|
||||
catalog = heap_open(InheritsRelationId, AccessShareLock);
|
||||
catalog = table_open(InheritsRelationId, AccessShareLock);
|
||||
ScanKeyInit(&skey, Anum_pg_inherits_inhrelid, BTEqualStrategyNumber,
|
||||
F_OIDEQ, ObjectIdGetDatum(relationId));
|
||||
scan = systable_beginscan(catalog, InheritsRelidSeqnoIndexId, true,
|
||||
NULL, 1, &skey);
|
||||
result = HeapTupleIsValid(systable_getnext(scan));
|
||||
systable_endscan(scan);
|
||||
heap_close(catalog, AccessShareLock);
|
||||
table_close(catalog, AccessShareLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -335,7 +335,7 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
|
||||
queue = list_make1_oid(subclassRelid);
|
||||
visited = NIL;
|
||||
|
||||
inhrel = heap_open(InheritsRelationId, AccessShareLock);
|
||||
inhrel = table_open(InheritsRelationId, AccessShareLock);
|
||||
|
||||
/*
|
||||
* Use queue to do a breadth-first traversal of the inheritance graph from
|
||||
@@ -397,7 +397,7 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
|
||||
}
|
||||
|
||||
/* clean up ... */
|
||||
heap_close(inhrel, AccessShareLock);
|
||||
table_close(inhrel, AccessShareLock);
|
||||
|
||||
list_free(visited);
|
||||
list_free(queue);
|
||||
@@ -416,7 +416,7 @@ StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
|
||||
HeapTuple tuple;
|
||||
Relation inhRelation;
|
||||
|
||||
inhRelation = heap_open(InheritsRelationId, RowExclusiveLock);
|
||||
inhRelation = table_open(InheritsRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Make the pg_inherits entry
|
||||
@@ -433,7 +433,7 @@ StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
|
||||
|
||||
heap_freetuple(tuple);
|
||||
|
||||
heap_close(inhRelation, RowExclusiveLock);
|
||||
table_close(inhRelation, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -457,7 +457,7 @@ DeleteInheritsTuple(Oid inhrelid, Oid inhparent)
|
||||
/*
|
||||
* Find pg_inherits entries by inhrelid.
|
||||
*/
|
||||
catalogRelation = heap_open(InheritsRelationId, RowExclusiveLock);
|
||||
catalogRelation = table_open(InheritsRelationId, RowExclusiveLock);
|
||||
ScanKeyInit(&key,
|
||||
Anum_pg_inherits_inhrelid,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
@@ -480,7 +480,7 @@ DeleteInheritsTuple(Oid inhrelid, Oid inhparent)
|
||||
|
||||
/* Done */
|
||||
systable_endscan(scan);
|
||||
heap_close(catalogRelation, RowExclusiveLock);
|
||||
table_close(catalogRelation, RowExclusiveLock);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user