Commit ab028965 authored by Tom Lane's avatar Tom Lane

Provide CatalogTupleDelete() as a wrapper around simple_heap_delete().

This extends the work done in commit 2f5c9d9c to provide a more nearly
complete abstraction layer hiding the details of index updating for catalog
changes.  That commit only invented abstractions for catalog inserts and
updates, leaving nearby code for catalog deletes still calling the
heap-level routines directly.  That seems rather ugly from here, and it
does little to help if we ever want to shift to a storage system in which
indexing work is needed at delete time.

Hence, create a wrapper function CatalogTupleDelete(), and replace calls
of simple_heap_delete() on catalog tuples with it.  There are now very
few direct calls of [simple_]heap_delete remaining in the tree.

Discussion: https://postgr.es/m/462.1485902736@sss.pgh.pa.us
parent bbd8550b
...@@ -1470,7 +1470,7 @@ RemoveDefaultACLById(Oid defaclOid) ...@@ -1470,7 +1470,7 @@ RemoveDefaultACLById(Oid defaclOid)
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for default ACL %u", defaclOid); elog(ERROR, "could not find tuple for default ACL %u", defaclOid);
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
...@@ -5718,8 +5718,10 @@ recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid, Acl *new_a ...@@ -5718,8 +5718,10 @@ recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid, Acl *new_a
CatalogTupleUpdate(relation, &oldtuple->t_self, oldtuple); CatalogTupleUpdate(relation, &oldtuple->t_self, oldtuple);
} }
else else
{
/* new_acl is NULL, so delete the entry we found. */ /* new_acl is NULL, so delete the entry we found. */
simple_heap_delete(relation, &oldtuple->t_self); CatalogTupleDelete(relation, &oldtuple->t_self);
}
} }
else else
{ {
......
...@@ -1062,7 +1062,7 @@ deleteOneObject(const ObjectAddress *object, Relation *depRel, int flags) ...@@ -1062,7 +1062,7 @@ deleteOneObject(const ObjectAddress *object, Relation *depRel, int flags)
while (HeapTupleIsValid(tup = systable_getnext(scan))) while (HeapTupleIsValid(tup = systable_getnext(scan)))
{ {
simple_heap_delete(*depRel, &tup->t_self); CatalogTupleDelete(*depRel, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
...@@ -2467,7 +2467,7 @@ DeleteInitPrivs(const ObjectAddress *object) ...@@ -2467,7 +2467,7 @@ DeleteInitPrivs(const ObjectAddress *object)
NULL, 3, key); NULL, 3, key);
while (HeapTupleIsValid(oldtuple = systable_getnext(scan))) while (HeapTupleIsValid(oldtuple = systable_getnext(scan)))
simple_heap_delete(relation, &oldtuple->t_self); CatalogTupleDelete(relation, &oldtuple->t_self);
systable_endscan(scan); systable_endscan(scan);
......
...@@ -1417,7 +1417,7 @@ RelationRemoveInheritance(Oid relid) ...@@ -1417,7 +1417,7 @@ RelationRemoveInheritance(Oid relid)
NULL, 1, &key); NULL, 1, &key);
while (HeapTupleIsValid(tuple = systable_getnext(scan))) while (HeapTupleIsValid(tuple = systable_getnext(scan)))
simple_heap_delete(catalogRelation, &tuple->t_self); CatalogTupleDelete(catalogRelation, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(catalogRelation, RowExclusiveLock); heap_close(catalogRelation, RowExclusiveLock);
...@@ -1445,7 +1445,7 @@ DeleteRelationTuple(Oid relid) ...@@ -1445,7 +1445,7 @@ DeleteRelationTuple(Oid relid)
elog(ERROR, "cache lookup failed for relation %u", relid); elog(ERROR, "cache lookup failed for relation %u", relid);
/* delete the relation tuple from pg_class, and finish up */ /* delete the relation tuple from pg_class, and finish up */
simple_heap_delete(pg_class_desc, &tup->t_self); CatalogTupleDelete(pg_class_desc, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1482,7 +1482,7 @@ DeleteAttributeTuples(Oid relid) ...@@ -1482,7 +1482,7 @@ DeleteAttributeTuples(Oid relid)
/* Delete all the matching tuples */ /* Delete all the matching tuples */
while ((atttup = systable_getnext(scan)) != NULL) while ((atttup = systable_getnext(scan)) != NULL)
simple_heap_delete(attrel, &atttup->t_self); CatalogTupleDelete(attrel, &atttup->t_self);
/* Clean up after the scan */ /* Clean up after the scan */
systable_endscan(scan); systable_endscan(scan);
...@@ -1523,7 +1523,7 @@ DeleteSystemAttributeTuples(Oid relid) ...@@ -1523,7 +1523,7 @@ DeleteSystemAttributeTuples(Oid relid)
/* Delete all the matching tuples */ /* Delete all the matching tuples */
while ((atttup = systable_getnext(scan)) != NULL) while ((atttup = systable_getnext(scan)) != NULL)
simple_heap_delete(attrel, &atttup->t_self); CatalogTupleDelete(attrel, &atttup->t_self);
/* Clean up after the scan */ /* Clean up after the scan */
systable_endscan(scan); systable_endscan(scan);
...@@ -1570,7 +1570,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum) ...@@ -1570,7 +1570,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
{ {
/* System attribute (probably OID) ... just delete the row */ /* System attribute (probably OID) ... just delete the row */
simple_heap_delete(attr_rel, &tuple->t_self); CatalogTupleDelete(attr_rel, &tuple->t_self);
} }
else else
{ {
...@@ -1715,7 +1715,7 @@ RemoveAttrDefaultById(Oid attrdefId) ...@@ -1715,7 +1715,7 @@ RemoveAttrDefaultById(Oid attrdefId)
myrel = relation_open(myrelid, AccessExclusiveLock); myrel = relation_open(myrelid, AccessExclusiveLock);
/* Now we can delete the pg_attrdef row */ /* Now we can delete the pg_attrdef row */
simple_heap_delete(attrdef_rel, &tuple->t_self); CatalogTupleDelete(attrdef_rel, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(attrdef_rel, RowExclusiveLock); heap_close(attrdef_rel, RowExclusiveLock);
...@@ -1809,7 +1809,7 @@ heap_drop_with_catalog(Oid relid) ...@@ -1809,7 +1809,7 @@ heap_drop_with_catalog(Oid relid)
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for foreign table %u", relid); elog(ERROR, "cache lookup failed for foreign table %u", relid);
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
...@@ -2764,7 +2764,7 @@ RemoveStatistics(Oid relid, AttrNumber attnum) ...@@ -2764,7 +2764,7 @@ RemoveStatistics(Oid relid, AttrNumber attnum)
/* we must loop even when attnum != 0, in case of inherited stats */ /* we must loop even when attnum != 0, in case of inherited stats */
while (HeapTupleIsValid(tuple = systable_getnext(scan))) while (HeapTupleIsValid(tuple = systable_getnext(scan)))
simple_heap_delete(pgstatistic, &tuple->t_self); CatalogTupleDelete(pgstatistic, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
...@@ -3196,7 +3196,7 @@ RemovePartitionKeyByRelId(Oid relid) ...@@ -3196,7 +3196,7 @@ RemovePartitionKeyByRelId(Oid relid)
elog(ERROR, "cache lookup failed for partition key of relation %u", elog(ERROR, "cache lookup failed for partition key of relation %u",
relid); relid);
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
......
...@@ -1573,7 +1573,7 @@ index_drop(Oid indexId, bool concurrent) ...@@ -1573,7 +1573,7 @@ index_drop(Oid indexId, bool concurrent)
hasexprs = !heap_attisnull(tuple, Anum_pg_index_indexprs); hasexprs = !heap_attisnull(tuple, Anum_pg_index_indexprs);
simple_heap_delete(indexRelation, &tuple->t_self); CatalogTupleDelete(indexRelation, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
heap_close(indexRelation, RowExclusiveLock); heap_close(indexRelation, RowExclusiveLock);
......
...@@ -192,3 +192,19 @@ CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup) ...@@ -192,3 +192,19 @@ CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
CatalogIndexInsert(indstate, tup); CatalogIndexInsert(indstate, tup);
CatalogCloseIndexes(indstate); CatalogCloseIndexes(indstate);
} }
/*
* CatalogTupleDelete - do heap and indexing work for deleting a catalog tuple
*
* Delete the tuple identified by tid in the specified catalog.
*
* With Postgres heaps, there is no index work to do at deletion time;
* cleanup will be done later by VACUUM. However, callers of this function
* shouldn't have to know that; we'd like a uniform abstraction for all
* catalog tuple changes. Hence, provide this currently-trivial wrapper.
*/
void
CatalogTupleDelete(Relation heapRel, ItemPointer tid)
{
simple_heap_delete(heapRel, tid);
}
...@@ -191,7 +191,7 @@ RemoveCollationById(Oid collationOid) ...@@ -191,7 +191,7 @@ RemoveCollationById(Oid collationOid)
tuple = systable_getnext(scandesc); tuple = systable_getnext(scandesc);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
else else
elog(ERROR, "could not find tuple for collation %u", collationOid); elog(ERROR, "could not find tuple for collation %u", collationOid);
......
...@@ -604,7 +604,7 @@ RemoveConstraintById(Oid conId) ...@@ -604,7 +604,7 @@ RemoveConstraintById(Oid conId)
elog(ERROR, "constraint %u is not of a known type", conId); elog(ERROR, "constraint %u is not of a known type", conId);
/* Fry the constraint itself */ /* Fry the constraint itself */
simple_heap_delete(conDesc, &tup->t_self); CatalogTupleDelete(conDesc, &tup->t_self);
/* Clean up */ /* Clean up */
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -165,7 +165,7 @@ RemoveConversionById(Oid conversionOid) ...@@ -165,7 +165,7 @@ RemoveConversionById(Oid conversionOid)
/* search for the target tuple */ /* search for the target tuple */
if (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection))) if (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection)))
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
else else
elog(ERROR, "could not find tuple for conversion %u", conversionOid); elog(ERROR, "could not find tuple for conversion %u", conversionOid);
heap_endscan(scan); heap_endscan(scan);
......
...@@ -91,7 +91,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt) ...@@ -91,7 +91,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
CatalogTupleUpdate(rel, &tuple->t_self, newtuple); CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
} }
else else
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
} }
} }
else if (HeapTupleIsValid(tuple)) else if (HeapTupleIsValid(tuple))
...@@ -129,7 +129,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt) ...@@ -129,7 +129,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
CatalogTupleUpdate(rel, &tuple->t_self, newtuple); CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
} }
else else
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
} }
else if (valuestr) else if (valuestr)
{ {
...@@ -199,7 +199,7 @@ DropSetting(Oid databaseid, Oid roleid) ...@@ -199,7 +199,7 @@ DropSetting(Oid databaseid, Oid roleid)
scan = heap_beginscan_catalog(relsetting, numkeys, keys); scan = heap_beginscan_catalog(relsetting, numkeys, keys);
while (HeapTupleIsValid(tup = heap_getnext(scan, ForwardScanDirection))) while (HeapTupleIsValid(tup = heap_getnext(scan, ForwardScanDirection)))
{ {
simple_heap_delete(relsetting, &tup->t_self); CatalogTupleDelete(relsetting, &tup->t_self);
} }
heap_endscan(scan); heap_endscan(scan);
......
...@@ -219,7 +219,7 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId, ...@@ -219,7 +219,7 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId,
((Form_pg_depend) GETSTRUCT(tup))->deptype == DEPENDENCY_EXTENSION) ((Form_pg_depend) GETSTRUCT(tup))->deptype == DEPENDENCY_EXTENSION)
continue; continue;
simple_heap_delete(depRel, &tup->t_self); CatalogTupleDelete(depRel, &tup->t_self);
count++; count++;
} }
...@@ -269,7 +269,7 @@ deleteDependencyRecordsForClass(Oid classId, Oid objectId, ...@@ -269,7 +269,7 @@ deleteDependencyRecordsForClass(Oid classId, Oid objectId,
if (depform->refclassid == refclassId && depform->deptype == deptype) if (depform->refclassid == refclassId && depform->deptype == deptype)
{ {
simple_heap_delete(depRel, &tup->t_self); CatalogTupleDelete(depRel, &tup->t_self);
count++; count++;
} }
} }
...@@ -353,7 +353,7 @@ changeDependencyFor(Oid classId, Oid objectId, ...@@ -353,7 +353,7 @@ changeDependencyFor(Oid classId, Oid objectId,
depform->refobjid == oldRefObjectId) depform->refobjid == oldRefObjectId)
{ {
if (newIsPinned) if (newIsPinned)
simple_heap_delete(depRel, &tup->t_self); CatalogTupleDelete(depRel, &tup->t_self);
else else
{ {
/* make a modifiable copy */ /* make a modifiable copy */
......
...@@ -161,7 +161,7 @@ EnumValuesDelete(Oid enumTypeOid) ...@@ -161,7 +161,7 @@ EnumValuesDelete(Oid enumTypeOid)
while (HeapTupleIsValid(tup = systable_getnext(scan))) while (HeapTupleIsValid(tup = systable_getnext(scan)))
{ {
simple_heap_delete(pg_enum, &tup->t_self); CatalogTupleDelete(pg_enum, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
......
...@@ -110,7 +110,7 @@ LargeObjectDrop(Oid loid) ...@@ -110,7 +110,7 @@ LargeObjectDrop(Oid loid)
(errcode(ERRCODE_UNDEFINED_OBJECT), (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("large object %u does not exist", loid))); errmsg("large object %u does not exist", loid)));
simple_heap_delete(pg_lo_meta, &tuple->t_self); CatalogTupleDelete(pg_lo_meta, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
...@@ -127,7 +127,7 @@ LargeObjectDrop(Oid loid) ...@@ -127,7 +127,7 @@ LargeObjectDrop(Oid loid)
NULL, 1, skey); NULL, 1, skey);
while (HeapTupleIsValid(tuple = systable_getnext(scan))) while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{ {
simple_heap_delete(pg_largeobject, &tuple->t_self); CatalogTupleDelete(pg_largeobject, &tuple->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
......
...@@ -129,7 +129,7 @@ RangeDelete(Oid rangeTypeOid) ...@@ -129,7 +129,7 @@ RangeDelete(Oid rangeTypeOid)
while (HeapTupleIsValid(tup = systable_getnext(scan))) while (HeapTupleIsValid(tup = systable_getnext(scan)))
{ {
simple_heap_delete(pg_range, &tup->t_self); CatalogTupleDelete(pg_range, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
......
...@@ -249,7 +249,7 @@ shdepChangeDep(Relation sdepRel, ...@@ -249,7 +249,7 @@ shdepChangeDep(Relation sdepRel,
{ {
/* No new entry needed, so just delete existing entry if any */ /* No new entry needed, so just delete existing entry if any */
if (oldtup) if (oldtup)
simple_heap_delete(sdepRel, &oldtup->t_self); CatalogTupleDelete(sdepRel, &oldtup->t_self);
} }
else if (oldtup) else if (oldtup)
{ {
...@@ -795,7 +795,7 @@ dropDatabaseDependencies(Oid databaseId) ...@@ -795,7 +795,7 @@ dropDatabaseDependencies(Oid databaseId)
while (HeapTupleIsValid(tup = systable_getnext(scan))) while (HeapTupleIsValid(tup = systable_getnext(scan)))
{ {
simple_heap_delete(sdepRel, &tup->t_self); CatalogTupleDelete(sdepRel, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
...@@ -948,7 +948,7 @@ shdepDropDependency(Relation sdepRel, ...@@ -948,7 +948,7 @@ shdepDropDependency(Relation sdepRel,
continue; continue;
/* OK, delete it */ /* OK, delete it */
simple_heap_delete(sdepRel, &tup->t_self); CatalogTupleDelete(sdepRel, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
......
...@@ -128,7 +128,7 @@ RemoveAccessMethodById(Oid amOid) ...@@ -128,7 +128,7 @@ RemoveAccessMethodById(Oid amOid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for access method %u", amOid); elog(ERROR, "cache lookup failed for access method %u", amOid);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -194,7 +194,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment) ...@@ -194,7 +194,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
/* Found the old tuple, so delete or update it */ /* Found the old tuple, so delete or update it */
if (comment == NULL) if (comment == NULL)
simple_heap_delete(description, &oldtuple->t_self); CatalogTupleDelete(description, &oldtuple->t_self);
else else
{ {
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values, newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values,
...@@ -284,7 +284,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment) ...@@ -284,7 +284,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
/* Found the old tuple, so delete or update it */ /* Found the old tuple, so delete or update it */
if (comment == NULL) if (comment == NULL)
simple_heap_delete(shdescription, &oldtuple->t_self); CatalogTupleDelete(shdescription, &oldtuple->t_self);
else else
{ {
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription), newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription),
...@@ -358,7 +358,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid) ...@@ -358,7 +358,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
NULL, nkeys, skey); NULL, nkeys, skey);
while ((oldtuple = systable_getnext(sd)) != NULL) while ((oldtuple = systable_getnext(sd)) != NULL)
simple_heap_delete(description, &oldtuple->t_self); CatalogTupleDelete(description, &oldtuple->t_self);
/* Done */ /* Done */
...@@ -394,7 +394,7 @@ DeleteSharedComments(Oid oid, Oid classoid) ...@@ -394,7 +394,7 @@ DeleteSharedComments(Oid oid, Oid classoid)
NULL, 2, skey); NULL, 2, skey);
while ((oldtuple = systable_getnext(sd)) != NULL) while ((oldtuple = systable_getnext(sd)) != NULL)
simple_heap_delete(shdescription, &oldtuple->t_self); CatalogTupleDelete(shdescription, &oldtuple->t_self);
/* Done */ /* Done */
......
...@@ -895,7 +895,7 @@ dropdb(const char *dbname, bool missing_ok) ...@@ -895,7 +895,7 @@ dropdb(const char *dbname, bool missing_ok)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for database %u", db_id); elog(ERROR, "cache lookup failed for database %u", db_id);
simple_heap_delete(pgdbrel, &tup->t_self); CatalogTupleDelete(pgdbrel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -484,7 +484,7 @@ RemoveEventTriggerById(Oid trigOid) ...@@ -484,7 +484,7 @@ RemoveEventTriggerById(Oid trigOid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for event trigger %u", trigOid); elog(ERROR, "cache lookup failed for event trigger %u", trigOid);
simple_heap_delete(tgrel, &tup->t_self); CatalogTupleDelete(tgrel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -1854,7 +1854,7 @@ RemoveExtensionById(Oid extId) ...@@ -1854,7 +1854,7 @@ RemoveExtensionById(Oid extId)
/* We assume that there can be at most one matching tuple */ /* We assume that there can be at most one matching tuple */
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
systable_endscan(scandesc); systable_endscan(scandesc);
......
...@@ -846,7 +846,7 @@ RemoveForeignDataWrapperById(Oid fdwId) ...@@ -846,7 +846,7 @@ RemoveForeignDataWrapperById(Oid fdwId)
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId); elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId);
simple_heap_delete(rel, &tp->t_self); CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp); ReleaseSysCache(tp);
...@@ -1080,7 +1080,7 @@ RemoveForeignServerById(Oid srvId) ...@@ -1080,7 +1080,7 @@ RemoveForeignServerById(Oid srvId)
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign server %u", srvId); elog(ERROR, "cache lookup failed for foreign server %u", srvId);
simple_heap_delete(rel, &tp->t_self); CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp); ReleaseSysCache(tp);
...@@ -1403,7 +1403,7 @@ RemoveUserMappingById(Oid umId) ...@@ -1403,7 +1403,7 @@ RemoveUserMappingById(Oid umId)
if (!HeapTupleIsValid(tp)) if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for user mapping %u", umId); elog(ERROR, "cache lookup failed for user mapping %u", umId);
simple_heap_delete(rel, &tp->t_self); CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp); ReleaseSysCache(tp);
......
...@@ -1131,7 +1131,7 @@ RemoveFunctionById(Oid funcOid) ...@@ -1131,7 +1131,7 @@ RemoveFunctionById(Oid funcOid)
isagg = ((Form_pg_proc) GETSTRUCT(tup))->proisagg; isagg = ((Form_pg_proc) GETSTRUCT(tup))->proisagg;
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1148,7 +1148,7 @@ RemoveFunctionById(Oid funcOid) ...@@ -1148,7 +1148,7 @@ RemoveFunctionById(Oid funcOid)
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid); elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1735,7 +1735,7 @@ DropCastById(Oid castOid) ...@@ -1735,7 +1735,7 @@ DropCastById(Oid castOid)
tuple = systable_getnext(scan); tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for cast %u", castOid); elog(ERROR, "could not find tuple for cast %u", castOid);
simple_heap_delete(relation, &tuple->t_self); CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(relation, RowExclusiveLock); heap_close(relation, RowExclusiveLock);
...@@ -2021,7 +2021,7 @@ DropTransformById(Oid transformOid) ...@@ -2021,7 +2021,7 @@ DropTransformById(Oid transformOid)
tuple = systable_getnext(scan); tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for transform %u", transformOid); elog(ERROR, "could not find tuple for transform %u", transformOid);
simple_heap_delete(relation, &tuple->t_self); CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(relation, RowExclusiveLock); heap_close(relation, RowExclusiveLock);
......
...@@ -1571,7 +1571,7 @@ RemoveOpFamilyById(Oid opfamilyOid) ...@@ -1571,7 +1571,7 @@ RemoveOpFamilyById(Oid opfamilyOid)
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid); elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1590,7 +1590,7 @@ RemoveOpClassById(Oid opclassOid) ...@@ -1590,7 +1590,7 @@ RemoveOpClassById(Oid opclassOid)
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opclass %u", opclassOid); elog(ERROR, "cache lookup failed for opclass %u", opclassOid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1620,7 +1620,7 @@ RemoveAmOpEntryById(Oid entryOid) ...@@ -1620,7 +1620,7 @@ RemoveAmOpEntryById(Oid entryOid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "could not find tuple for amop entry %u", entryOid); elog(ERROR, "could not find tuple for amop entry %u", entryOid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
...@@ -1649,7 +1649,7 @@ RemoveAmProcEntryById(Oid entryOid) ...@@ -1649,7 +1649,7 @@ RemoveAmProcEntryById(Oid entryOid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "could not find tuple for amproc entry %u", entryOid); elog(ERROR, "could not find tuple for amproc entry %u", entryOid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
......
...@@ -368,7 +368,7 @@ RemoveOperatorById(Oid operOid) ...@@ -368,7 +368,7 @@ RemoveOperatorById(Oid operOid)
} }
} }
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -397,7 +397,7 @@ RemovePolicyById(Oid policy_id) ...@@ -397,7 +397,7 @@ RemovePolicyById(Oid policy_id)
errmsg("permission denied: \"%s\" is a system catalog", errmsg("permission denied: \"%s\" is a system catalog",
RelationGetRelationName(rel)))); RelationGetRelationName(rel))));
simple_heap_delete(pg_policy_rel, &tuple->t_self); CatalogTupleDelete(pg_policy_rel, &tuple->t_self);
systable_endscan(sscan); systable_endscan(sscan);
......
...@@ -536,7 +536,7 @@ DropProceduralLanguageById(Oid langOid) ...@@ -536,7 +536,7 @@ DropProceduralLanguageById(Oid langOid)
if (!HeapTupleIsValid(langTup)) /* should not happen */ if (!HeapTupleIsValid(langTup)) /* should not happen */
elog(ERROR, "cache lookup failed for language %u", langOid); elog(ERROR, "cache lookup failed for language %u", langOid);
simple_heap_delete(rel, &langTup->t_self); CatalogTupleDelete(rel, &langTup->t_self);
ReleaseSysCache(langTup); ReleaseSysCache(langTup);
......
...@@ -461,7 +461,7 @@ RemovePublicationById(Oid pubid) ...@@ -461,7 +461,7 @@ RemovePublicationById(Oid pubid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication %u", pubid); elog(ERROR, "cache lookup failed for publication %u", pubid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -486,13 +486,12 @@ RemovePublicationRelById(Oid proid) ...@@ -486,13 +486,12 @@ RemovePublicationRelById(Oid proid)
elog(ERROR, "cache lookup failed for publication table %u", elog(ERROR, "cache lookup failed for publication table %u",
proid); proid);
pubrel = (Form_pg_publication_rel) GETSTRUCT(tup); pubrel = (Form_pg_publication_rel) GETSTRUCT(tup);
/* Invalidate relcache so that publication info is rebuilt. */ /* Invalidate relcache so that publication info is rebuilt. */
CacheInvalidateRelcacheByRelid(pubrel->prrelid); CacheInvalidateRelcacheByRelid(pubrel->prrelid);
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -226,7 +226,7 @@ RemoveSchemaById(Oid schemaOid) ...@@ -226,7 +226,7 @@ RemoveSchemaById(Oid schemaOid)
if (!HeapTupleIsValid(tup)) /* should not happen */ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for namespace %u", schemaOid); elog(ERROR, "cache lookup failed for namespace %u", schemaOid);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -293,7 +293,7 @@ SetSharedSecurityLabel(const ObjectAddress *object, ...@@ -293,7 +293,7 @@ SetSharedSecurityLabel(const ObjectAddress *object,
if (HeapTupleIsValid(oldtup)) if (HeapTupleIsValid(oldtup))
{ {
if (label == NULL) if (label == NULL)
simple_heap_delete(pg_shseclabel, &oldtup->t_self); CatalogTupleDelete(pg_shseclabel, &oldtup->t_self);
else else
{ {
replaces[Anum_pg_shseclabel_label - 1] = true; replaces[Anum_pg_shseclabel_label - 1] = true;
...@@ -380,7 +380,7 @@ SetSecurityLabel(const ObjectAddress *object, ...@@ -380,7 +380,7 @@ SetSecurityLabel(const ObjectAddress *object,
if (HeapTupleIsValid(oldtup)) if (HeapTupleIsValid(oldtup))
{ {
if (label == NULL) if (label == NULL)
simple_heap_delete(pg_seclabel, &oldtup->t_self); CatalogTupleDelete(pg_seclabel, &oldtup->t_self);
else else
{ {
replaces[Anum_pg_seclabel_label - 1] = true; replaces[Anum_pg_seclabel_label - 1] = true;
...@@ -432,7 +432,7 @@ DeleteSharedSecurityLabel(Oid objectId, Oid classId) ...@@ -432,7 +432,7 @@ DeleteSharedSecurityLabel(Oid objectId, Oid classId)
scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId, true, scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId, true,
NULL, 2, skey); NULL, 2, skey);
while (HeapTupleIsValid(oldtup = systable_getnext(scan))) while (HeapTupleIsValid(oldtup = systable_getnext(scan)))
simple_heap_delete(pg_shseclabel, &oldtup->t_self); CatalogTupleDelete(pg_shseclabel, &oldtup->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(pg_shseclabel, RowExclusiveLock); heap_close(pg_shseclabel, RowExclusiveLock);
...@@ -483,7 +483,7 @@ DeleteSecurityLabel(const ObjectAddress *object) ...@@ -483,7 +483,7 @@ DeleteSecurityLabel(const ObjectAddress *object)
scan = systable_beginscan(pg_seclabel, SecLabelObjectIndexId, true, scan = systable_beginscan(pg_seclabel, SecLabelObjectIndexId, true,
NULL, nkeys, skey); NULL, nkeys, skey);
while (HeapTupleIsValid(oldtup = systable_getnext(scan))) while (HeapTupleIsValid(oldtup = systable_getnext(scan)))
simple_heap_delete(pg_seclabel, &oldtup->t_self); CatalogTupleDelete(pg_seclabel, &oldtup->t_self);
systable_endscan(scan); systable_endscan(scan);
heap_close(pg_seclabel, RowExclusiveLock); heap_close(pg_seclabel, RowExclusiveLock);
......
...@@ -521,7 +521,7 @@ DeleteSequenceTuple(Oid relid) ...@@ -521,7 +521,7 @@ DeleteSequenceTuple(Oid relid)
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for sequence %u", relid); elog(ERROR, "cache lookup failed for sequence %u", relid);
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
......
...@@ -501,7 +501,7 @@ DropSubscription(DropSubscriptionStmt *stmt) ...@@ -501,7 +501,7 @@ DropSubscription(DropSubscriptionStmt *stmt)
EventTriggerSQLDropAddObject(&myself, true, true); EventTriggerSQLDropAddObject(&myself, true, true);
/* Remove the tuple from catalog. */ /* Remove the tuple from catalog. */
simple_heap_delete(rel, &tup->t_self); CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
......
...@@ -8939,7 +8939,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, ...@@ -8939,7 +8939,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
foundDep->refobjid == attTup->attcollation)) foundDep->refobjid == attTup->attcollation))
elog(ERROR, "found unexpected dependency for column"); elog(ERROR, "found unexpected dependency for column");
simple_heap_delete(depRel, &depTup->t_self); CatalogTupleDelete(depRel, &depTup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
...@@ -11177,7 +11177,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel) ...@@ -11177,7 +11177,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel)
inhparent = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhparent; inhparent = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhparent;
if (inhparent == RelationGetRelid(parent_rel)) if (inhparent == RelationGetRelid(parent_rel))
{ {
simple_heap_delete(catalogRelation, &inheritsTuple->t_self); CatalogTupleDelete(catalogRelation, &inheritsTuple->t_self);
found = true; found = true;
break; break;
} }
...@@ -11370,7 +11370,7 @@ drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid) ...@@ -11370,7 +11370,7 @@ drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid)
dep->refobjid == refobjid && dep->refobjid == refobjid &&
dep->refobjsubid == 0 && dep->refobjsubid == 0 &&
dep->deptype == DEPENDENCY_NORMAL) dep->deptype == DEPENDENCY_NORMAL)
simple_heap_delete(catalogRelation, &depTuple->t_self); CatalogTupleDelete(catalogRelation, &depTuple->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
......
...@@ -460,7 +460,7 @@ DropTableSpace(DropTableSpaceStmt *stmt) ...@@ -460,7 +460,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
/* /*
* Remove the pg_tablespace tuple (this will roll back if we fail below) * Remove the pg_tablespace tuple (this will roll back if we fail below)
*/ */
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
heap_endscan(scandesc); heap_endscan(scandesc);
......
...@@ -1238,7 +1238,7 @@ RemoveTriggerById(Oid trigOid) ...@@ -1238,7 +1238,7 @@ RemoveTriggerById(Oid trigOid)
/* /*
* Delete the pg_trigger tuple. * Delete the pg_trigger tuple.
*/ */
simple_heap_delete(tgrel, &tup->t_self); CatalogTupleDelete(tgrel, &tup->t_self);
systable_endscan(tgscan); systable_endscan(tgscan);
heap_close(tgrel, RowExclusiveLock); heap_close(tgrel, RowExclusiveLock);
......
...@@ -301,7 +301,7 @@ RemoveTSParserById(Oid prsId) ...@@ -301,7 +301,7 @@ RemoveTSParserById(Oid prsId)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", prsId); elog(ERROR, "cache lookup failed for text search parser %u", prsId);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -511,7 +511,7 @@ RemoveTSDictionaryById(Oid dictId) ...@@ -511,7 +511,7 @@ RemoveTSDictionaryById(Oid dictId)
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId); dictId);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -831,7 +831,7 @@ RemoveTSTemplateById(Oid tmplId) ...@@ -831,7 +831,7 @@ RemoveTSTemplateById(Oid tmplId)
elog(ERROR, "cache lookup failed for text search template %u", elog(ERROR, "cache lookup failed for text search template %u",
tmplId); tmplId);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1139,7 +1139,7 @@ RemoveTSConfigurationById(Oid cfgId) ...@@ -1139,7 +1139,7 @@ RemoveTSConfigurationById(Oid cfgId)
elog(ERROR, "cache lookup failed for text search dictionary %u", elog(ERROR, "cache lookup failed for text search dictionary %u",
cfgId); cfgId);
simple_heap_delete(relCfg, &tup->t_self); CatalogTupleDelete(relCfg, &tup->t_self);
ReleaseSysCache(tup); ReleaseSysCache(tup);
...@@ -1158,7 +1158,7 @@ RemoveTSConfigurationById(Oid cfgId) ...@@ -1158,7 +1158,7 @@ RemoveTSConfigurationById(Oid cfgId)
while (HeapTupleIsValid((tup = systable_getnext(scan)))) while (HeapTupleIsValid((tup = systable_getnext(scan))))
{ {
simple_heap_delete(relMap, &tup->t_self); CatalogTupleDelete(relMap, &tup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
...@@ -1317,7 +1317,7 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt, ...@@ -1317,7 +1317,7 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
while (HeapTupleIsValid((maptup = systable_getnext(scan)))) while (HeapTupleIsValid((maptup = systable_getnext(scan))))
{ {
simple_heap_delete(relMap, &maptup->t_self); CatalogTupleDelete(relMap, &maptup->t_self);
} }
systable_endscan(scan); systable_endscan(scan);
...@@ -1472,7 +1472,7 @@ DropConfigurationMapping(AlterTSConfigurationStmt *stmt, ...@@ -1472,7 +1472,7 @@ DropConfigurationMapping(AlterTSConfigurationStmt *stmt,
while (HeapTupleIsValid((maptup = systable_getnext(scan)))) while (HeapTupleIsValid((maptup = systable_getnext(scan))))
{ {
simple_heap_delete(relMap, &maptup->t_self); CatalogTupleDelete(relMap, &maptup->t_self);
found = true; found = true;
} }
......
...@@ -697,7 +697,7 @@ RemoveTypeById(Oid typeOid) ...@@ -697,7 +697,7 @@ RemoveTypeById(Oid typeOid)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for type %u", typeOid); elog(ERROR, "cache lookup failed for type %u", typeOid);
simple_heap_delete(relation, &tup->t_self); CatalogTupleDelete(relation, &tup->t_self);
/* /*
* If it is an enum, delete the pg_enum entries too; we don't bother with * If it is an enum, delete the pg_enum entries too; we don't bother with
......
...@@ -1044,7 +1044,7 @@ DropRole(DropRoleStmt *stmt) ...@@ -1044,7 +1044,7 @@ DropRole(DropRoleStmt *stmt)
/* /*
* Remove the role from the pg_authid table * Remove the role from the pg_authid table
*/ */
simple_heap_delete(pg_authid_rel, &tuple->t_self); CatalogTupleDelete(pg_authid_rel, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
...@@ -1064,7 +1064,7 @@ DropRole(DropRoleStmt *stmt) ...@@ -1064,7 +1064,7 @@ DropRole(DropRoleStmt *stmt)
while (HeapTupleIsValid(tmp_tuple = systable_getnext(sscan))) while (HeapTupleIsValid(tmp_tuple = systable_getnext(sscan)))
{ {
simple_heap_delete(pg_auth_members_rel, &tmp_tuple->t_self); CatalogTupleDelete(pg_auth_members_rel, &tmp_tuple->t_self);
} }
systable_endscan(sscan); systable_endscan(sscan);
...@@ -1079,7 +1079,7 @@ DropRole(DropRoleStmt *stmt) ...@@ -1079,7 +1079,7 @@ DropRole(DropRoleStmt *stmt)
while (HeapTupleIsValid(tmp_tuple = systable_getnext(sscan))) while (HeapTupleIsValid(tmp_tuple = systable_getnext(sscan)))
{ {
simple_heap_delete(pg_auth_members_rel, &tmp_tuple->t_self); CatalogTupleDelete(pg_auth_members_rel, &tmp_tuple->t_self);
} }
systable_endscan(sscan); systable_endscan(sscan);
...@@ -1606,7 +1606,7 @@ DelRoleMems(const char *rolename, Oid roleid, ...@@ -1606,7 +1606,7 @@ DelRoleMems(const char *rolename, Oid roleid,
if (!admin_opt) if (!admin_opt)
{ {
/* Remove the entry altogether */ /* Remove the entry altogether */
simple_heap_delete(pg_authmem_rel, &authmem_tuple->t_self); CatalogTupleDelete(pg_authmem_rel, &authmem_tuple->t_self);
} }
else else
{ {
......
...@@ -377,7 +377,7 @@ replorigin_drop(RepOriginId roident) ...@@ -377,7 +377,7 @@ replorigin_drop(RepOriginId roident)
elog(ERROR, "cache lookup failed for replication origin with oid %u", elog(ERROR, "cache lookup failed for replication origin with oid %u",
roident); roident);
simple_heap_delete(rel, &tuple->t_self); CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
CommandCounterIncrement(); CommandCounterIncrement();
......
...@@ -76,7 +76,7 @@ RemoveRewriteRuleById(Oid ruleOid) ...@@ -76,7 +76,7 @@ RemoveRewriteRuleById(Oid ruleOid)
/* /*
* Now delete the pg_rewrite tuple for the rule * Now delete the pg_rewrite tuple for the rule
*/ */
simple_heap_delete(RewriteRelation, &tuple->t_self); CatalogTupleDelete(RewriteRelation, &tuple->t_self);
systable_endscan(rcscan); systable_endscan(rcscan);
......
...@@ -861,7 +861,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len) ...@@ -861,7 +861,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len)
if (olddata != NULL) if (olddata != NULL)
{ {
Assert(olddata->pageno > pageno); Assert(olddata->pageno > pageno);
simple_heap_delete(lo_heap_r, &oldtuple->t_self); CatalogTupleDelete(lo_heap_r, &oldtuple->t_self);
} }
/* /*
...@@ -897,7 +897,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len) ...@@ -897,7 +897,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len)
{ {
while ((oldtuple = systable_getnext_ordered(sd, ForwardScanDirection)) != NULL) while ((oldtuple = systable_getnext_ordered(sd, ForwardScanDirection)) != NULL)
{ {
simple_heap_delete(lo_heap_r, &oldtuple->t_self); CatalogTupleDelete(lo_heap_r, &oldtuple->t_self);
} }
} }
......
...@@ -35,6 +35,7 @@ extern void CatalogIndexInsert(CatalogIndexState indstate, ...@@ -35,6 +35,7 @@ extern void CatalogIndexInsert(CatalogIndexState indstate,
extern Oid CatalogTupleInsert(Relation heapRel, HeapTuple tup); extern Oid CatalogTupleInsert(Relation heapRel, HeapTuple tup);
extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid,
HeapTuple tup); HeapTuple tup);
extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid);
/* /*
......
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