values[Anum_pg_default_acl_defaclacl - 1] = PointerGetDatum(new_acl);
newtuple = heap_form_tuple(RelationGetDescr(rel), values, nulls);
- simple_heap_insert(rel, newtuple);
+ CatalogTupleInsert(rel, newtuple);
}
else
{
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
values, nulls, replaces);
- simple_heap_update(rel, &newtuple->t_self, newtuple);
+ CatalogTupleUpdate(rel, &newtuple->t_self, newtuple);
}
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(rel, newtuple);
-
/* these dependencies don't change in an update */
if (isNew)
{
newtuple = heap_modify_tuple(attr_tuple, RelationGetDescr(attRelation),
values, nulls, replaces);
- simple_heap_update(attRelation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(attRelation, newtuple);
+ CatalogTupleUpdate(attRelation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(relOid, RelationRelationId, attnum,
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation),
values, nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(relOid, RelationRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update the shared dependency ACL info */
updateAclDependencies(DatabaseRelationId, HeapTupleGetOid(tuple), 0,
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(fdwid, ForeignDataWrapperRelationId, 0,
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(srvid, ForeignServerRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(funcId, ProcedureRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(langId, LanguageRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation),
values, nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(loid, LargeObjectRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(nspid, NamespaceRelationId, 0, new_acl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update the shared dependency ACL info */
updateAclDependencies(TableSpaceRelationId, tblId, 0,
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
/* Update initial privileges for extensions */
recordExtensionInitPriv(typId, TypeRelationId, 0, new_acl);
oldtuple = heap_modify_tuple(oldtuple, RelationGetDescr(relation),
values, nulls, replace);
- simple_heap_update(relation, &oldtuple->t_self, oldtuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, oldtuple);
+ CatalogTupleUpdate(relation, &oldtuple->t_self, oldtuple);
}
else
/* new_acl is NULL, so delete the entry we found. */
tuple = heap_form_tuple(RelationGetDescr(relation), values, nulls);
- simple_heap_insert(relation, tuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relation, tuple);
+ CatalogTupleInsert(relation, tuple);
}
}
if (indstate != NULL)
CatalogIndexInsert(indstate, tup);
else
- CatalogUpdateIndexes(pg_attribute_rel, tup);
+ {
+ CatalogIndexState indstate;
+
+ indstate = CatalogOpenIndexes(pg_attribute_rel);
+ CatalogIndexInsert(indstate, tup);
+ CatalogCloseIndexes(indstate);
+ }
heap_freetuple(tup);
}
HeapTupleSetOid(tup, new_rel_oid);
/* finally insert the new tuple, update the indexes, and clean up */
- simple_heap_insert(pg_class_desc, tup);
-
- CatalogUpdateIndexes(pg_class_desc, tup);
+ CatalogTupleInsert(pg_class_desc, tup);
heap_freetuple(tup);
}
"........pg.dropped.%d........", attnum);
namestrcpy(&(attStruct->attname), newattname);
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
}
/*
((Form_pg_attribute) GETSTRUCT(tuple))->atthasdef = false;
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
/*
* Our update of the pg_attribute row will force a relcache rebuild, so
adrel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
tuple = heap_form_tuple(adrel->rd_att, values, nulls);
- attrdefOid = simple_heap_insert(adrel, tuple);
-
- CatalogUpdateIndexes(adrel, tuple);
+ attrdefOid = CatalogTupleInsert(adrel, tuple);
defobject.classId = AttrDefaultRelationId;
defobject.objectId = attrdefOid;
if (!attStruct->atthasdef)
{
attStruct->atthasdef = true;
- simple_heap_update(attrrel, &atttup->t_self, atttup);
- /* keep catalog indexes current */
- CatalogUpdateIndexes(attrrel, atttup);
+ CatalogTupleUpdate(attrrel, &atttup->t_self, atttup);
}
heap_close(attrrel, RowExclusiveLock);
heap_freetuple(atttup);
Assert(is_local);
con->connoinherit = true;
}
- simple_heap_update(conDesc, &tup->t_self, tup);
- CatalogUpdateIndexes(conDesc, tup);
+ CatalogTupleUpdate(conDesc, &tup->t_self, tup);
break;
}
}
{
relStruct->relchecks = numchecks;
- simple_heap_update(relrel, &reltup->t_self, reltup);
-
- /* keep catalog indexes current */
- CatalogUpdateIndexes(relrel, reltup);
+ CatalogTupleUpdate(relrel, &reltup->t_self, reltup);
}
else
{
tuple = heap_form_tuple(RelationGetDescr(pg_partitioned_table), values, nulls);
- simple_heap_insert(pg_partitioned_table, tuple);
-
- /* Update the indexes on pg_partitioned_table */
- CatalogUpdateIndexes(pg_partitioned_table, tuple);
+ CatalogTupleInsert(pg_partitioned_table, tuple);
heap_close(pg_partitioned_table, RowExclusiveLock);
/* Mark this relation as dependent on a few things as follows */
new_val, new_null, new_repl);
/* Also set the flag */
((Form_pg_class) GETSTRUCT(newtuple))->relispartition = true;
- simple_heap_update(classRel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(classRel, newtuple);
+ CatalogTupleUpdate(classRel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
heap_close(classRel, RowExclusiveLock);
/*
* insert the tuple into the pg_index catalog
*/
- simple_heap_insert(pg_index, tuple);
-
- /* update the indexes on pg_index */
- CatalogUpdateIndexes(pg_index, tuple);
+ CatalogTupleInsert(pg_index, tuple);
/*
* close the relation and free the tuple
if (dirty)
{
- simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
- CatalogUpdateIndexes(pg_index, indexTuple);
+ CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
InvokeObjectPostAlterHookArg(IndexRelationId, indexRelationId, 0,
InvalidOid, is_internal);
Assert(!indexForm->indcheckxmin);
indexForm->indcheckxmin = true;
- simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
- CatalogUpdateIndexes(pg_index, indexTuple);
+ CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
heap_freetuple(indexTuple);
heap_close(pg_index, RowExclusiveLock);
indexForm->indisvalid = true;
indexForm->indisready = true;
indexForm->indislive = true;
- simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
- CatalogUpdateIndexes(pg_index, indexTuple);
+ CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
/*
* Invalidate the relcache for the table, so that after we commit
}
/*
- * CatalogUpdateIndexes - do all the indexing work for a new catalog tuple
+ * CatalogTupleInsert - do heap and indexing work for a new catalog tuple
*
- * This is a convenience routine for the common case where we only need
- * to insert or update a single tuple in a system catalog. Avoid using it for
- * multiple tuples, since opening the indexes and building the index info
- * structures is moderately expensive.
+ * This is a convenience routine for the common case of inserting a single
+ * tuple in a system catalog; it inserts a new heap tuple, keeping indexes
+ * current. Avoid using it for multiple tuples, since opening the indexes and
+ * building the index info structures is moderately expensive.
+ *
+ * The Oid of the inserted tuple is returned.
+ */
+Oid
+CatalogTupleInsert(Relation heapRel, HeapTuple tup)
+{
+ CatalogIndexState indstate;
+ Oid oid;
+
+ indstate = CatalogOpenIndexes(heapRel);
+
+ oid = simple_heap_insert(heapRel, tup);
+
+ CatalogIndexInsert(indstate, tup);
+ CatalogCloseIndexes(indstate);
+
+ return oid;
+}
+
+/*
+ * CatalogTupleUpdate - do heap and indexing work for updating a catalog tuple
+ *
+ * This is a convenience routine for the common case of updating a single
+ * tuple in a system catalog; it updates one heap tuple (identified by otid)
+ * with tup, keeping indexes current. Avoid using it for multiple tuples,
+ * since opening the indexes and building the index info structures is
+ * moderately expensive.
*/
void
-CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple)
+CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
{
CatalogIndexState indstate;
indstate = CatalogOpenIndexes(heapRel);
- CatalogIndexInsert(indstate, heapTuple);
+
+ simple_heap_update(heapRel, otid, tup);
+
+ CatalogIndexInsert(indstate, tup);
CatalogCloseIndexes(indstate);
}
tupDesc = aggdesc->rd_att;
tup = heap_form_tuple(tupDesc, values, nulls);
- simple_heap_insert(aggdesc, tup);
-
- CatalogUpdateIndexes(aggdesc, tup);
+ CatalogTupleInsert(aggdesc, tup);
heap_close(aggdesc, RowExclusiveLock);
tup = heap_form_tuple(tupDesc, values, nulls);
/* insert a new tuple */
- oid = simple_heap_insert(rel, tup);
+ oid = CatalogTupleInsert(rel, tup);
Assert(OidIsValid(oid));
- /* update the index if any */
- CatalogUpdateIndexes(rel, tup);
-
/* set up dependencies for the new collation */
myself.classId = CollationRelationId;
myself.objectId = oid;
tup = heap_form_tuple(RelationGetDescr(conDesc), values, nulls);
- conOid = simple_heap_insert(conDesc, tup);
-
- /* update catalog indexes */
- CatalogUpdateIndexes(conDesc, tup);
+ conOid = CatalogTupleInsert(conDesc, tup);
conobject.classId = ConstraintRelationId;
conobject.objectId = conOid;
RelationGetRelationName(rel));
classForm->relchecks--;
- simple_heap_update(pgrel, &relTup->t_self, relTup);
-
- CatalogUpdateIndexes(pgrel, relTup);
+ CatalogTupleUpdate(pgrel, &relTup->t_self, relTup);
heap_freetuple(relTup);
/* OK, do the rename --- tuple is a copy, so OK to scribble on it */
namestrcpy(&(con->conname), newname);
- simple_heap_update(conDesc, &tuple->t_self, tuple);
-
- /* update the system catalog indexes */
- CatalogUpdateIndexes(conDesc, tuple);
+ CatalogTupleUpdate(conDesc, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(ConstraintRelationId, conId, 0);
conform->connamespace = newNspId;
- simple_heap_update(conRel, &tup->t_self, tup);
- CatalogUpdateIndexes(conRel, tup);
+ CatalogTupleUpdate(conRel, &tup->t_self, tup);
/*
* Note: currently, the constraint will not have its own
tup = heap_form_tuple(tupDesc, values, nulls);
/* insert a new tuple */
- simple_heap_insert(rel, tup);
-
- /* update the index if any */
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleInsert(rel, tup);
myself.classId = ConversionRelationId;
myself.objectId = HeapTupleGetOid(tup);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &tuple->t_self, newtuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
}
else
simple_heap_delete(rel, &tuple->t_self);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &tuple->t_self, newtuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
}
else
simple_heap_delete(rel, &tuple->t_self);
values[Anum_pg_db_role_setting_setconfig - 1] = PointerGetDatum(a);
newtuple = heap_form_tuple(RelationGetDescr(rel), values, nulls);
- simple_heap_insert(rel, newtuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleInsert(rel, newtuple);
}
InvokeObjectPostAlterHookArg(DbRoleSettingRelationId,
depform->refobjid = newRefObjectId;
- simple_heap_update(depRel, &tup->t_self, tup);
- CatalogUpdateIndexes(depRel, tup);
+ CatalogTupleUpdate(depRel, &tup->t_self, tup);
heap_freetuple(tup);
}
tup = heap_form_tuple(RelationGetDescr(pg_enum), values, nulls);
HeapTupleSetOid(tup, oids[elemno]);
- simple_heap_insert(pg_enum, tup);
- CatalogUpdateIndexes(pg_enum, tup);
+ CatalogTupleInsert(pg_enum, tup);
heap_freetuple(tup);
elemno++;
values[Anum_pg_enum_enumlabel - 1] = NameGetDatum(&enumlabel);
enum_tup = heap_form_tuple(RelationGetDescr(pg_enum), values, nulls);
HeapTupleSetOid(enum_tup, newOid);
- simple_heap_insert(pg_enum, enum_tup);
- CatalogUpdateIndexes(pg_enum, enum_tup);
+ CatalogTupleInsert(pg_enum, enum_tup);
heap_freetuple(enum_tup);
heap_close(pg_enum, RowExclusiveLock);
/* Update the pg_enum entry */
namestrcpy(&en->enumlabel, newVal);
- simple_heap_update(pg_enum, &enum_tup->t_self, enum_tup);
- CatalogUpdateIndexes(pg_enum, enum_tup);
+ CatalogTupleUpdate(pg_enum, &enum_tup->t_self, enum_tup);
heap_freetuple(enum_tup);
heap_close(pg_enum, RowExclusiveLock);
{
en->enumsortorder = newsortorder;
- simple_heap_update(pg_enum, &newtup->t_self, newtup);
-
- CatalogUpdateIndexes(pg_enum, newtup);
+ CatalogTupleUpdate(pg_enum, &newtup->t_self, newtup);
}
heap_freetuple(newtup);
if (OidIsValid(loid))
HeapTupleSetOid(ntup, loid);
- loid_new = simple_heap_insert(pg_lo_meta, ntup);
+ loid_new = CatalogTupleInsert(pg_lo_meta, ntup);
Assert(!OidIsValid(loid) || loid == loid_new);
- CatalogUpdateIndexes(pg_lo_meta, ntup);
-
heap_freetuple(ntup);
heap_close(pg_lo_meta, RowExclusiveLock);
tup = heap_form_tuple(tupDesc, values, nulls);
- nspoid = simple_heap_insert(nspdesc, tup);
+ nspoid = CatalogTupleInsert(nspdesc, tup);
Assert(OidIsValid(nspoid));
- CatalogUpdateIndexes(nspdesc, tup);
-
heap_close(nspdesc, RowExclusiveLock);
/* Record dependencies */
/*
* insert our "shell" operator tuple
*/
- operatorObjectId = simple_heap_insert(pg_operator_desc, tup);
-
- CatalogUpdateIndexes(pg_operator_desc, tup);
+ operatorObjectId = CatalogTupleInsert(pg_operator_desc, tup);
/* Add dependencies for the entry */
makeOperatorDependencies(tup, false);
nulls,
replaces);
- simple_heap_update(pg_operator_desc, &tup->t_self, tup);
+ CatalogTupleUpdate(pg_operator_desc, &tup->t_self, tup);
}
else
{
tup = heap_form_tuple(RelationGetDescr(pg_operator_desc),
values, nulls);
- operatorObjectId = simple_heap_insert(pg_operator_desc, tup);
+ operatorObjectId = CatalogTupleInsert(pg_operator_desc, tup);
}
- /* Must update the indexes in either case */
- CatalogUpdateIndexes(pg_operator_desc, tup);
-
/* Add dependencies for the entry */
address = makeOperatorDependencies(tup, isUpdate);
/* If any columns were found to need modification, update tuple. */
if (update_commutator)
{
- simple_heap_update(pg_operator_desc, &tup->t_self, tup);
- CatalogUpdateIndexes(pg_operator_desc, tup);
+ CatalogTupleUpdate(pg_operator_desc, &tup->t_self, tup);
/*
* Do CCI to make the updated tuple visible. We must do this in
/* If any columns were found to need modification, update tuple. */
if (update_negator)
{
- simple_heap_update(pg_operator_desc, &tup->t_self, tup);
- CatalogUpdateIndexes(pg_operator_desc, tup);
+ CatalogTupleUpdate(pg_operator_desc, &tup->t_self, tup);
/*
* In the deletion case, do CCI to make the updated tuple visible.
/* Okay, do it... */
tup = heap_modify_tuple(oldtup, tupDesc, values, nulls, replaces);
- simple_heap_update(rel, &tup->t_self, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
ReleaseSysCache(oldtup);
is_update = true;
nulls[Anum_pg_proc_proacl - 1] = true;
tup = heap_form_tuple(tupDesc, values, nulls);
- simple_heap_insert(rel, tup);
+ CatalogTupleInsert(rel, tup);
is_update = false;
}
- /* Need to update indexes for either the insert or update case */
- CatalogUpdateIndexes(rel, tup);
retval = HeapTupleGetOid(tup);
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
/* Insert tuple into catalog. */
- prrelid = simple_heap_insert(rel, tup);
- CatalogUpdateIndexes(rel, tup);
+ prrelid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
ObjectAddressSet(myself, PublicationRelRelationId, prrelid);
tup = heap_form_tuple(RelationGetDescr(pg_range), values, nulls);
- simple_heap_insert(pg_range, tup);
- CatalogUpdateIndexes(pg_range, tup);
+ CatalogTupleInsert(pg_range, tup);
heap_freetuple(tup);
/* record type's dependencies on range-related items */
shForm->refclassid = refclassid;
shForm->refobjid = refobjid;
- simple_heap_update(sdepRel, &oldtup->t_self, oldtup);
-
- /* keep indexes current */
- CatalogUpdateIndexes(sdepRel, oldtup);
+ CatalogTupleUpdate(sdepRel, &oldtup->t_self, oldtup);
}
else
{
* it's certainly a new tuple
*/
oldtup = heap_form_tuple(RelationGetDescr(sdepRel), values, nulls);
- simple_heap_insert(sdepRel, oldtup);
-
- /* keep indexes current */
- CatalogUpdateIndexes(sdepRel, oldtup);
+ CatalogTupleInsert(sdepRel, oldtup);
}
if (oldtup)
HeapTuple newtup;
newtup = heap_modify_tuple(tup, sdepDesc, values, nulls, replace);
- simple_heap_insert(sdepRel, newtup);
-
- /* Keep indexes current */
- CatalogIndexInsert(indstate, newtup);
+ CatalogTupleInsert(sdepRel, newtup);
heap_freetuple(newtup);
}
tup = heap_form_tuple(sdepRel->rd_att, values, nulls);
- simple_heap_insert(sdepRel, tup);
-
- /* keep indexes current */
- CatalogUpdateIndexes(sdepRel, tup);
+ CatalogTupleInsert(sdepRel, tup);
/* clean up */
heap_freetuple(tup);
/*
* insert the tuple in the relation and get the tuple's oid.
*/
- typoid = simple_heap_insert(pg_type_desc, tup);
-
- CatalogUpdateIndexes(pg_type_desc, tup);
+ typoid = CatalogTupleInsert(pg_type_desc, tup);
/*
* Create dependencies. We can/must skip this in bootstrap mode.
nulls,
replaces);
- simple_heap_update(pg_type_desc, &tup->t_self, tup);
+ CatalogTupleUpdate(pg_type_desc, &tup->t_self, tup);
typeObjectId = HeapTupleGetOid(tup);
}
/* else allow system to assign oid */
- typeObjectId = simple_heap_insert(pg_type_desc, tup);
+ typeObjectId = CatalogTupleInsert(pg_type_desc, tup);
}
- /* Update indexes */
- CatalogUpdateIndexes(pg_type_desc, tup);
-
/*
* Create dependencies. We can/must skip this in bootstrap mode.
*/
/* OK, do the rename --- tuple is a copy, so OK to scribble on it */
namestrcpy(&(typ->typname), newTypeName);
- simple_heap_update(pg_type_desc, &tuple->t_self, tuple);
-
- /* update the system catalog indexes */
- CatalogUpdateIndexes(pg_type_desc, tuple);
+ CatalogTupleUpdate(pg_type_desc, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(TypeRelationId, typeOid, 0);
if (!IsBootstrapProcessingMode())
{
/* normal case, use a transactional update */
- simple_heap_update(class_rel, &reltup->t_self, reltup);
-
- /* Keep catalog indexes current */
- CatalogUpdateIndexes(class_rel, reltup);
+ CatalogTupleUpdate(class_rel, &reltup->t_self, reltup);
}
else
{
values, nulls, replaces);
/* Perform actual update */
- simple_heap_update(rel, &oldtup->t_self, newtup);
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &oldtup->t_self, newtup);
InvokeObjectPostAlterHook(classId, objectId, 0);
values, nulls, replaces);
/* Perform actual update */
- simple_heap_update(rel, &tup->t_self, newtup);
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &tup->t_self, newtup);
/* Release memory */
pfree(values);
values, nulls, replaces);
/* Perform actual update */
- simple_heap_update(rel, &newtup->t_self, newtup);
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &newtup->t_self, newtup);
/* Update owner dependency reference */
if (classId == LargeObjectMetadataRelationId)
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
- amoid = simple_heap_insert(rel, tup);
- CatalogUpdateIndexes(rel, tup);
+ amoid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
myself.classId = AccessMethodRelationId;
nulls,
replaces);
ReleaseSysCache(oldtup);
- simple_heap_update(sd, &stup->t_self, stup);
+ CatalogTupleUpdate(sd, &stup->t_self, stup);
}
else
{
/* No, insert new tuple */
stup = heap_form_tuple(RelationGetDescr(sd), values, nulls);
- simple_heap_insert(sd, stup);
+ CatalogTupleInsert(sd, stup);
}
- /* update indexes too */
- CatalogUpdateIndexes(sd, stup);
-
heap_freetuple(stup);
}
if (indexForm->indisclustered)
{
indexForm->indisclustered = false;
- simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
- CatalogUpdateIndexes(pg_index, indexTuple);
+ CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
}
else if (thisIndexOid == indexOid)
{
if (!IndexIsValid(indexForm))
elog(ERROR, "cannot cluster on invalid index %u", indexOid);
indexForm->indisclustered = true;
- simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
- CatalogUpdateIndexes(pg_index, indexTuple);
+ CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
}
InvokeObjectPostAlterHookArg(IndexRelationId, thisIndexOid, 0,
relform->relfrozenxid = frozenXid;
relform->relminmxid = cutoffMulti;
- simple_heap_update(relRelation, &reltup->t_self, reltup);
- CatalogUpdateIndexes(relRelation, reltup);
+ CatalogTupleUpdate(relRelation, &reltup->t_self, reltup);
heap_close(relRelation, RowExclusiveLock);
}
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values,
nulls, replaces);
- simple_heap_update(description, &oldtuple->t_self, newtuple);
+ CatalogTupleUpdate(description, &oldtuple->t_self, newtuple);
}
break; /* Assume there can be only one match */
{
newtuple = heap_form_tuple(RelationGetDescr(description),
values, nulls);
- simple_heap_insert(description, newtuple);
+ CatalogTupleInsert(description, newtuple);
}
- /* Update indexes, if necessary */
if (newtuple != NULL)
- {
- CatalogUpdateIndexes(description, newtuple);
heap_freetuple(newtuple);
- }
/* Done */
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription),
values, nulls, replaces);
- simple_heap_update(shdescription, &oldtuple->t_self, newtuple);
+ CatalogTupleUpdate(shdescription, &oldtuple->t_self, newtuple);
}
break; /* Assume there can be only one match */
{
newtuple = heap_form_tuple(RelationGetDescr(shdescription),
values, nulls);
- simple_heap_insert(shdescription, newtuple);
+ CatalogTupleInsert(shdescription, newtuple);
}
- /* Update indexes, if necessary */
if (newtuple != NULL)
- {
- CatalogUpdateIndexes(shdescription, newtuple);
heap_freetuple(newtuple);
- }
/* Done */
HeapTupleSetOid(tuple, dboid);
- simple_heap_insert(pg_database_rel, tuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(pg_database_rel, tuple);
+ CatalogTupleInsert(pg_database_rel, tuple);
/*
* Now generate additional catalog entries associated with the new DB
if (!HeapTupleIsValid(newtup))
elog(ERROR, "cache lookup failed for database %u", db_id);
namestrcpy(&(((Form_pg_database) GETSTRUCT(newtup))->datname), newname);
- simple_heap_update(rel, &newtup->t_self, newtup);
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &newtup->t_self, newtup);
InvokeObjectPostAlterHook(DatabaseRelationId, db_id, 0);
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(pgdbrel),
new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(pgdbrel, &oldtuple->t_self, newtuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(pgdbrel, newtuple);
+ CatalogTupleUpdate(pgdbrel, &oldtuple->t_self, newtuple);
InvokeObjectPostAlterHook(DatabaseRelationId,
HeapTupleGetOid(newtuple), 0);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(rel, &tuple->t_self, newtuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &tuple->t_self, newtuple);
InvokeObjectPostAlterHook(DatabaseRelationId,
HeapTupleGetOid(newtuple), 0);
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
/* Insert heap tuple. */
tuple = heap_form_tuple(tgrel->rd_att, values, nulls);
- trigoid = simple_heap_insert(tgrel, tuple);
- CatalogUpdateIndexes(tgrel, tuple);
+ trigoid = CatalogTupleInsert(tgrel, tuple);
heap_freetuple(tuple);
/* Depend on owner. */
evtForm = (Form_pg_event_trigger) GETSTRUCT(tup);
evtForm->evtenabled = tgenabled;
- simple_heap_update(tgrel, &tup->t_self, tup);
- CatalogUpdateIndexes(tgrel, tup);
+ CatalogTupleUpdate(tgrel, &tup->t_self, tup);
InvokeObjectPostAlterHook(EventTriggerRelationId,
trigoid, 0);
errhint("The owner of an event trigger must be a superuser.")));
form->evtowner = newOwnerId;
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Update owner dependency reference */
changeDependencyOnOwner(EventTriggerRelationId,
tuple = heap_form_tuple(rel->rd_att, values, nulls);
- extensionOid = simple_heap_insert(rel, tuple);
- CatalogUpdateIndexes(rel, tuple);
+ extensionOid = CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
heap_close(rel, RowExclusiveLock);
extTup = heap_modify_tuple(extTup, RelationGetDescr(extRel),
repl_val, repl_null, repl_repl);
- simple_heap_update(extRel, &extTup->t_self, extTup);
- CatalogUpdateIndexes(extRel, extTup);
+ CatalogTupleUpdate(extRel, &extTup->t_self, extTup);
systable_endscan(extScan);
extTup = heap_modify_tuple(extTup, RelationGetDescr(extRel),
repl_val, repl_null, repl_repl);
- simple_heap_update(extRel, &extTup->t_self, extTup);
- CatalogUpdateIndexes(extRel, extTup);
+ CatalogTupleUpdate(extRel, &extTup->t_self, extTup);
systable_endscan(extScan);
/* Now adjust pg_extension.extnamespace */
extForm->extnamespace = nspOid;
- simple_heap_update(extRel, &extTup->t_self, extTup);
- CatalogUpdateIndexes(extRel, extTup);
+ CatalogTupleUpdate(extRel, &extTup->t_self, extTup);
heap_close(extRel, RowExclusiveLock);
extTup = heap_modify_tuple(extTup, RelationGetDescr(extRel),
values, nulls, repl);
- simple_heap_update(extRel, &extTup->t_self, extTup);
- CatalogUpdateIndexes(extRel, extTup);
+ CatalogTupleUpdate(extRel, &extTup->t_self, extTup);
systable_endscan(extScan);
tup = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null,
repl_repl);
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Update owner dependency reference */
changeDependencyOnOwner(ForeignDataWrapperRelationId,
tup = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null,
repl_repl);
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Update owner dependency reference */
changeDependencyOnOwner(ForeignServerRelationId, HeapTupleGetOid(tup),
tuple = heap_form_tuple(rel->rd_att, values, nulls);
- fdwId = simple_heap_insert(rel, tuple);
- CatalogUpdateIndexes(rel, tuple);
+ fdwId = CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &tp->t_self, tp);
- CatalogUpdateIndexes(rel, tp);
+ CatalogTupleUpdate(rel, &tp->t_self, tp);
heap_freetuple(tp);
tuple = heap_form_tuple(rel->rd_att, values, nulls);
- srvId = simple_heap_insert(rel, tuple);
-
- CatalogUpdateIndexes(rel, tuple);
+ srvId = CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &tp->t_self, tp);
- CatalogUpdateIndexes(rel, tp);
+ CatalogTupleUpdate(rel, &tp->t_self, tp);
InvokeObjectPostAlterHook(ForeignServerRelationId, srvId, 0);
tuple = heap_form_tuple(rel->rd_att, values, nulls);
- umId = simple_heap_insert(rel, tuple);
-
- CatalogUpdateIndexes(rel, tuple);
+ umId = CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &tp->t_self, tp);
- CatalogUpdateIndexes(rel, tp);
+ CatalogTupleUpdate(rel, &tp->t_self, tp);
ObjectAddressSet(address, UserMappingRelationId, umId);
tuple = heap_form_tuple(ftrel->rd_att, values, nulls);
- simple_heap_insert(ftrel, tuple);
- CatalogUpdateIndexes(ftrel, tuple);
+ CatalogTupleInsert(ftrel, tuple);
heap_freetuple(tuple);
procForm->proparallel = interpret_func_parallel(parallel_item);
/* Do the update */
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
InvokeObjectPostAlterHook(ProcedureRelationId, funcOid, 0);
procForm->prorettype = newRetType;
/* update the catalog and its indexes */
- simple_heap_update(pg_proc_rel, &tup->t_self, tup);
-
- CatalogUpdateIndexes(pg_proc_rel, tup);
+ CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup);
heap_close(pg_proc_rel, RowExclusiveLock);
}
procForm->proargtypes.values[argIndex] = newArgType;
/* update the catalog and its indexes */
- simple_heap_update(pg_proc_rel, &tup->t_self, tup);
-
- CatalogUpdateIndexes(pg_proc_rel, tup);
+ CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup);
heap_close(pg_proc_rel, RowExclusiveLock);
}
tuple = heap_form_tuple(RelationGetDescr(relation), values, nulls);
- castid = simple_heap_insert(relation, tuple);
-
- CatalogUpdateIndexes(relation, tuple);
+ castid = CatalogTupleInsert(relation, tuple);
/* make dependency entries */
myself.classId = CastRelationId;
replaces[Anum_pg_transform_trftosql - 1] = true;
newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values, nulls, replaces);
- simple_heap_update(relation, &newtuple->t_self, newtuple);
+ CatalogTupleUpdate(relation, &newtuple->t_self, newtuple);
transformid = HeapTupleGetOid(tuple);
ReleaseSysCache(tuple);
else
{
newtuple = heap_form_tuple(RelationGetDescr(relation), values, nulls);
- transformid = simple_heap_insert(relation, newtuple);
+ transformid = CatalogTupleInsert(relation, newtuple);
is_replace = false;
}
- CatalogUpdateIndexes(relation, newtuple);
-
if (is_replace)
deleteDependencyRecordsFor(TransformRelationId, transformid, true);
((Form_pg_class) GETSTRUCT(tuple))->relispopulated = newstate;
- simple_heap_update(pgrel, &tuple->t_self, tuple);
-
- CatalogUpdateIndexes(pgrel, tuple);
+ CatalogTupleUpdate(pgrel, &tuple->t_self, tuple);
heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
tup = heap_form_tuple(rel->rd_att, values, nulls);
- opfamilyoid = simple_heap_insert(rel, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ opfamilyoid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
tup = heap_form_tuple(rel->rd_att, values, nulls);
- opclassoid = simple_heap_insert(rel, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ opclassoid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
tup = heap_form_tuple(rel->rd_att, values, nulls);
- entryoid = simple_heap_insert(rel, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ entryoid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
tup = heap_form_tuple(rel->rd_att, values, nulls);
- entryoid = simple_heap_insert(rel, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ entryoid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
tup = heap_modify_tuple(tup, RelationGetDescr(catalog),
values, nulls, replaces);
- simple_heap_update(catalog, &tup->t_self, tup);
- CatalogUpdateIndexes(catalog, tup);
+ CatalogTupleUpdate(catalog, &tup->t_self, tup);
address = makeOperatorDependencies(tup, true);
new_tuple = heap_modify_tuple(tuple,
RelationGetDescr(pg_policy_rel),
values, isnull, replaces);
- simple_heap_update(pg_policy_rel, &new_tuple->t_self, new_tuple);
-
- /* Update Catalog Indexes */
- CatalogUpdateIndexes(pg_policy_rel, new_tuple);
+ CatalogTupleUpdate(pg_policy_rel, &new_tuple->t_self, new_tuple);
/* Remove all old dependencies. */
deleteDependencyRecordsFor(PolicyRelationId, policy_id, false);
policy_tuple = heap_form_tuple(RelationGetDescr(pg_policy_rel), values,
isnull);
- policy_id = simple_heap_insert(pg_policy_rel, policy_tuple);
-
- /* Update Indexes */
- CatalogUpdateIndexes(pg_policy_rel, policy_tuple);
+ policy_id = CatalogTupleInsert(pg_policy_rel, policy_tuple);
/* Record Dependencies */
target.classId = RelationRelationId;
new_tuple = heap_modify_tuple(policy_tuple,
RelationGetDescr(pg_policy_rel),
values, isnull, replaces);
- simple_heap_update(pg_policy_rel, &new_tuple->t_self, new_tuple);
-
- /* Update Catalog Indexes */
- CatalogUpdateIndexes(pg_policy_rel, new_tuple);
+ CatalogTupleUpdate(pg_policy_rel, &new_tuple->t_self, new_tuple);
/* Update Dependencies. */
deleteDependencyRecordsFor(PolicyRelationId, policy_id, false);
namestrcpy(&((Form_pg_policy) GETSTRUCT(policy_tuple))->polname,
stmt->newname);
- simple_heap_update(pg_policy_rel, &policy_tuple->t_self, policy_tuple);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(pg_policy_rel, policy_tuple);
+ CatalogTupleUpdate(pg_policy_rel, &policy_tuple->t_self, policy_tuple);
InvokeObjectPostAlterHook(PolicyRelationId,
HeapTupleGetOid(policy_tuple), 0);
/* Okay, do it... */
tup = heap_modify_tuple(oldtup, tupDesc, values, nulls, replaces);
- simple_heap_update(rel, &tup->t_self, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
ReleaseSysCache(oldtup);
is_update = true;
{
/* Creating a new language */
tup = heap_form_tuple(tupDesc, values, nulls);
- simple_heap_insert(rel, tup);
+ CatalogTupleInsert(rel, tup);
is_update = false;
}
- /* Need to update indexes for either the insert or update case */
- CatalogUpdateIndexes(rel, tup);
-
/*
* Create dependencies for the new language. If we are updating an
* existing language, first delete any existing pg_depend entries.
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
/* Insert tuple into catalog. */
- puboid = simple_heap_insert(rel, tup);
- CatalogUpdateIndexes(rel, tup);
+ puboid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
recordDependencyOnOwner(PublicationRelationId, puboid, GetUserId());
replaces);
/* Update the catalog. */
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
CommandCounterIncrement();
errhint("The owner of a publication must be a superuser.")));
form->pubowner = newOwnerId;
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Update owner dependency reference */
changeDependencyOnOwner(PublicationRelationId,
/* rename */
namestrcpy(&(((Form_pg_namespace) GETSTRUCT(tup))->nspname), newname);
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
InvokeObjectPostAlterHook(NamespaceRelationId, HeapTupleGetOid(tup), 0);
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
replaces[Anum_pg_shseclabel_label - 1] = true;
newtup = heap_modify_tuple(oldtup, RelationGetDescr(pg_shseclabel),
values, nulls, replaces);
- simple_heap_update(pg_shseclabel, &oldtup->t_self, newtup);
+ CatalogTupleUpdate(pg_shseclabel, &oldtup->t_self, newtup);
}
}
systable_endscan(scan);
{
newtup = heap_form_tuple(RelationGetDescr(pg_shseclabel),
values, nulls);
- simple_heap_insert(pg_shseclabel, newtup);
+ CatalogTupleInsert(pg_shseclabel, newtup);
}
- /* Update indexes, if necessary */
if (newtup != NULL)
- {
- CatalogUpdateIndexes(pg_shseclabel, newtup);
heap_freetuple(newtup);
- }
heap_close(pg_shseclabel, RowExclusiveLock);
}
replaces[Anum_pg_seclabel_label - 1] = true;
newtup = heap_modify_tuple(oldtup, RelationGetDescr(pg_seclabel),
values, nulls, replaces);
- simple_heap_update(pg_seclabel, &oldtup->t_self, newtup);
+ CatalogTupleUpdate(pg_seclabel, &oldtup->t_self, newtup);
}
}
systable_endscan(scan);
{
newtup = heap_form_tuple(RelationGetDescr(pg_seclabel),
values, nulls);
- simple_heap_insert(pg_seclabel, newtup);
+ CatalogTupleInsert(pg_seclabel, newtup);
}
/* Update indexes, if necessary */
if (newtup != NULL)
- {
- CatalogUpdateIndexes(pg_seclabel, newtup);
heap_freetuple(newtup);
- }
heap_close(pg_seclabel, RowExclusiveLock);
}
pgs_values[Anum_pg_sequence_seqcache - 1] = Int64GetDatumFast(seqform.seqcache);
tuple = heap_form_tuple(tupDesc, pgs_values, pgs_nulls);
- simple_heap_insert(rel, tuple);
- CatalogUpdateIndexes(rel, tuple);
+ CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
heap_close(rel, RowExclusiveLock);
relation_close(seqrel, NoLock);
- simple_heap_update(rel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(rel, tuple);
+ CatalogTupleUpdate(rel, &tuple->t_self, tuple);
heap_close(rel, RowExclusiveLock);
return address;
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
/* Insert tuple into catalog. */
- subid = simple_heap_insert(rel, tup);
- CatalogUpdateIndexes(rel, tup);
+ subid = CatalogTupleInsert(rel, tup);
heap_freetuple(tup);
recordDependencyOnOwner(SubscriptionRelationId, subid, owner);
replaces);
/* Update the catalog. */
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
ObjectAddressSet(myself, SubscriptionRelationId, subid);
errhint("The owner of an subscription must be a superuser.")));
form->subowner = newOwnerId;
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Update owner dependency reference */
changeDependencyOnOwner(SubscriptionRelationId,
tuple = heap_form_tuple(desc, values, nulls);
- simple_heap_insert(inhRelation, tuple);
-
- CatalogUpdateIndexes(inhRelation, tuple);
+ CatalogTupleInsert(inhRelation, tuple);
heap_freetuple(tuple);
if (classtuple->relhassubclass != relhassubclass)
{
classtuple->relhassubclass = relhassubclass;
- simple_heap_update(relationRelation, &tuple->t_self, tuple);
-
- /* keep the catalog indexes up to date */
- CatalogUpdateIndexes(relationRelation, tuple);
+ CatalogTupleUpdate(relationRelation, &tuple->t_self, tuple);
}
else
{
/* apply the update */
namestrcpy(&(attform->attname), newattname);
- simple_heap_update(attrelation, &atttup->t_self, atttup);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(attrelation, atttup);
+ CatalogTupleUpdate(attrelation, &atttup->t_self, atttup);
InvokeObjectPostAlterHook(RelationRelationId, myrelid, attnum);
*/
namestrcpy(&(relform->relname), newrelname);
- simple_heap_update(relrelation, &reltup->t_self, reltup);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(relrelation, reltup);
+ CatalogTupleUpdate(relrelation, &reltup->t_self, reltup);
InvokeObjectPostAlterHookArg(RelationRelationId, myrelid, 0,
InvalidOid, is_internal);
/* Bump the existing child att's inhcount */
childatt->attinhcount++;
- simple_heap_update(attrdesc, &tuple->t_self, tuple);
- CatalogUpdateIndexes(attrdesc, tuple);
+ CatalogTupleUpdate(attrdesc, &tuple->t_self, tuple);
heap_freetuple(tuple);
else
((Form_pg_class) GETSTRUCT(reltup))->relnatts = newattnum;
- simple_heap_update(pgclass, &reltup->t_self, reltup);
-
- /* keep catalog indexes current */
- CatalogUpdateIndexes(pgclass, reltup);
+ CatalogTupleUpdate(pgclass, &reltup->t_self, reltup);
heap_freetuple(reltup);
{
((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = FALSE;
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
ObjectAddressSubSet(address, RelationRelationId,
RelationGetRelid(rel), attnum);
{
((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = TRUE;
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
/* Tell Phase 3 it needs to test the constraint */
tab->new_notnull = true;
attrtuple->attstattarget = newtarget;
- simple_heap_update(attrelation, &tuple->t_self, tuple);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(attrelation, tuple);
+ CatalogTupleUpdate(attrelation, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(RelationRelationId,
RelationGetRelid(rel),
repl_val, repl_null, repl_repl);
/* Update system catalog. */
- simple_heap_update(attrelation, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(attrelation, newtuple);
+ CatalogTupleUpdate(attrelation, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHook(RelationRelationId,
RelationGetRelid(rel),
errmsg("column data type %s can only have storage PLAIN",
format_type_be(attrtuple->atttypid))));
- simple_heap_update(attrelation, &tuple->t_self, tuple);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(attrelation, tuple);
+ CatalogTupleUpdate(attrelation, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(RelationRelationId,
RelationGetRelid(rel),
/* Child column must survive my deletion */
childatt->attinhcount--;
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
/* Make update visible */
CommandCounterIncrement();
childatt->attinhcount--;
childatt->attislocal = true;
- simple_heap_update(attr_rel, &tuple->t_self, tuple);
-
- /* keep the system catalog indexes current */
- CatalogUpdateIndexes(attr_rel, tuple);
+ CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
/* Make update visible */
CommandCounterIncrement();
tuple_class = (Form_pg_class) GETSTRUCT(tuple);
tuple_class->relhasoids = false;
- simple_heap_update(class_rel, &tuple->t_self, tuple);
-
- /* Keep the catalog indexes up to date */
- CatalogUpdateIndexes(class_rel, tuple);
+ CatalogTupleUpdate(class_rel, &tuple->t_self, tuple);
heap_close(class_rel, RowExclusiveLock);
copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple);
copy_con->condeferrable = cmdcon->deferrable;
copy_con->condeferred = cmdcon->initdeferred;
- simple_heap_update(conrel, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(conrel, copyTuple);
+ CatalogTupleUpdate(conrel, ©Tuple->t_self, copyTuple);
InvokeObjectPostAlterHook(ConstraintRelationId,
HeapTupleGetOid(contuple), 0);
copy_tg->tgdeferrable = cmdcon->deferrable;
copy_tg->tginitdeferred = cmdcon->initdeferred;
- simple_heap_update(tgrel, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(tgrel, copyTuple);
+ CatalogTupleUpdate(tgrel, ©Tuple->t_self, copyTuple);
InvokeObjectPostAlterHook(TriggerRelationId,
HeapTupleGetOid(tgtuple), 0);
copyTuple = heap_copytuple(tuple);
copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple);
copy_con->convalidated = true;
- simple_heap_update(conrel, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(conrel, copyTuple);
+ CatalogTupleUpdate(conrel, ©Tuple->t_self, copyTuple);
InvokeObjectPostAlterHook(ConstraintRelationId,
HeapTupleGetOid(tuple), 0);
{
/* Child constraint must survive my deletion */
con->coninhcount--;
- simple_heap_update(conrel, ©_tuple->t_self, copy_tuple);
- CatalogUpdateIndexes(conrel, copy_tuple);
+ CatalogTupleUpdate(conrel, ©_tuple->t_self, copy_tuple);
/* Make update visible */
CommandCounterIncrement();
con->coninhcount--;
con->conislocal = true;
- simple_heap_update(conrel, ©_tuple->t_self, copy_tuple);
- CatalogUpdateIndexes(conrel, copy_tuple);
+ CatalogTupleUpdate(conrel, ©_tuple->t_self, copy_tuple);
/* Make update visible */
CommandCounterIncrement();
ReleaseSysCache(typeTuple);
- simple_heap_update(attrelation, &heapTup->t_self, heapTup);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(attrelation, heapTup);
+ CatalogTupleUpdate(attrelation, &heapTup->t_self, heapTup);
heap_close(attrelation, RowExclusiveLock);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(attrel),
repl_val, repl_null, repl_repl);
- simple_heap_update(attrel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(attrel, newtuple);
+ CatalogTupleUpdate(attrel, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHook(RelationRelationId,
RelationGetRelid(rel),
newtuple = heap_modify_tuple(tuple, RelationGetDescr(class_rel), repl_val, repl_null, repl_repl);
- simple_heap_update(class_rel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(class_rel, newtuple);
+ CatalogTupleUpdate(class_rel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
RelationGetDescr(attRelation),
repl_val, repl_null, repl_repl);
- simple_heap_update(attRelation, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(attRelation, newtuple);
+ CatalogTupleUpdate(attRelation, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass),
repl_val, repl_null, repl_repl);
- simple_heap_update(pgclass, &newtuple->t_self, newtuple);
-
- CatalogUpdateIndexes(pgclass, newtuple);
+ CatalogTupleUpdate(pgclass, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHook(RelationRelationId, RelationGetRelid(rel), 0);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass),
repl_val, repl_null, repl_repl);
- simple_heap_update(pgclass, &newtuple->t_self, newtuple);
-
- CatalogUpdateIndexes(pgclass, newtuple);
+ CatalogTupleUpdate(pgclass, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHookArg(RelationRelationId,
RelationGetRelid(toastrel), 0,
/* update the pg_class row */
rd_rel->reltablespace = (newTableSpace == MyDatabaseTableSpace) ? InvalidOid : newTableSpace;
rd_rel->relfilenode = newrelfilenode;
- simple_heap_update(pg_class, &tuple->t_self, tuple);
- CatalogUpdateIndexes(pg_class, tuple);
+ CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(RelationRelationId, RelationGetRelid(rel), 0);
childatt->attislocal = false;
}
- simple_heap_update(attrrel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(attrrel, tuple);
+ CatalogTupleUpdate(attrrel, &tuple->t_self, tuple);
heap_freetuple(tuple);
}
else
childatt->attislocal = false;
}
- simple_heap_update(attrrel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(attrrel, tuple);
+ CatalogTupleUpdate(attrrel, &tuple->t_self, tuple);
heap_freetuple(tuple);
}
else
child_con->conislocal = false;
}
- simple_heap_update(catalog_relation, &child_copy->t_self, child_copy);
- CatalogUpdateIndexes(catalog_relation, child_copy);
+ CatalogTupleUpdate(catalog_relation, &child_copy->t_self, child_copy);
heap_freetuple(child_copy);
found = true;
if (copy_att->attinhcount == 0)
copy_att->attislocal = true;
- simple_heap_update(catalogRelation, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(catalogRelation, copyTuple);
+ CatalogTupleUpdate(catalogRelation, ©Tuple->t_self, copyTuple);
heap_freetuple(copyTuple);
}
}
if (copy_con->coninhcount == 0)
copy_con->conislocal = true;
- simple_heap_update(catalogRelation, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(catalogRelation, copyTuple);
+ CatalogTupleUpdate(catalogRelation, ©Tuple->t_self, copyTuple);
heap_freetuple(copyTuple);
}
}
if (!HeapTupleIsValid(classtuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(classtuple))->reloftype = typeid;
- simple_heap_update(relationRelation, &classtuple->t_self, classtuple);
- CatalogUpdateIndexes(relationRelation, classtuple);
+ CatalogTupleUpdate(relationRelation, &classtuple->t_self, classtuple);
InvokeObjectPostAlterHook(RelationRelationId, relid, 0);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(tuple))->reloftype = InvalidOid;
- simple_heap_update(relationRelation, &tuple->t_self, tuple);
- CatalogUpdateIndexes(relationRelation, tuple);
+ CatalogTupleUpdate(relationRelation, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(RelationRelationId, relid, 0);
if (pg_class_form->relreplident != ri_type)
{
pg_class_form->relreplident = ri_type;
- simple_heap_update(pg_class, &pg_class_tuple->t_self, pg_class_tuple);
- CatalogUpdateIndexes(pg_class, pg_class_tuple);
+ CatalogTupleUpdate(pg_class, &pg_class_tuple->t_self, pg_class_tuple);
}
heap_close(pg_class, RowExclusiveLock);
heap_freetuple(pg_class_tuple);
if (dirty)
{
- simple_heap_update(pg_index, &pg_index_tuple->t_self, pg_index_tuple);
- CatalogUpdateIndexes(pg_index, pg_index_tuple);
+ CatalogTupleUpdate(pg_index, &pg_index_tuple->t_self, pg_index_tuple);
InvokeObjectPostAlterHookArg(IndexRelationId, thisIndexOid, 0,
InvalidOid, is_internal);
}
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(tuple))->relrowsecurity = true;
- simple_heap_update(pg_class, &tuple->t_self, tuple);
-
- /* keep catalog indexes current */
- CatalogUpdateIndexes(pg_class, tuple);
+ CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
heap_close(pg_class, RowExclusiveLock);
heap_freetuple(tuple);
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(tuple))->relrowsecurity = false;
- simple_heap_update(pg_class, &tuple->t_self, tuple);
-
- /* keep catalog indexes current */
- CatalogUpdateIndexes(pg_class, tuple);
+ CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
heap_close(pg_class, RowExclusiveLock);
heap_freetuple(tuple);
elog(ERROR, "cache lookup failed for relation %u", relid);
((Form_pg_class) GETSTRUCT(tuple))->relforcerowsecurity = force_rls;
- simple_heap_update(pg_class, &tuple->t_self, tuple);
-
- /* keep catalog indexes current */
- CatalogUpdateIndexes(pg_class, tuple);
+ CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
heap_close(pg_class, RowExclusiveLock);
heap_freetuple(tuple);
tuple = heap_modify_tuple(tuple, RelationGetDescr(ftrel),
repl_val, repl_null, repl_repl);
- simple_heap_update(ftrel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(ftrel, tuple);
+ CatalogTupleUpdate(ftrel, &tuple->t_self, tuple);
/*
* Invalidate relcache so that all sessions will refresh any cached plans
/* classTup is a copy, so OK to scribble on */
classForm->relnamespace = newNspOid;
- simple_heap_update(classRel, &classTup->t_self, classTup);
- CatalogUpdateIndexes(classRel, classTup);
+ CatalogTupleUpdate(classRel, &classTup->t_self, classTup);
/* Update dependency on schema if caller said so */
if (hasDependEntry &&
new_val, new_null, new_repl);
((Form_pg_class) GETSTRUCT(newtuple))->relispartition = false;
- simple_heap_update(classRel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(classRel, newtuple);
+ CatalogTupleUpdate(classRel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
heap_close(classRel, RowExclusiveLock);
tuple = heap_form_tuple(rel->rd_att, values, nulls);
- tablespaceoid = simple_heap_insert(rel, tuple);
-
- CatalogUpdateIndexes(rel, tuple);
+ tablespaceoid = CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
/* OK, update the entry */
namestrcpy(&(newform->spcname), newname);
- simple_heap_update(rel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHook(TableSpaceRelationId, tspId, 0);
repl_null, repl_repl);
/* Update system catalog. */
- simple_heap_update(rel, &newtuple->t_self, newtuple);
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &newtuple->t_self, newtuple);
InvokeObjectPostAlterHook(TableSpaceRelationId, HeapTupleGetOid(tup), 0);
/*
* Insert tuple into pg_trigger.
*/
- simple_heap_insert(tgrel, tuple);
-
- CatalogUpdateIndexes(tgrel, tuple);
+ CatalogTupleInsert(tgrel, tuple);
heap_freetuple(tuple);
heap_close(tgrel, RowExclusiveLock);
((Form_pg_class) GETSTRUCT(tuple))->relhastriggers = true;
- simple_heap_update(pgrel, &tuple->t_self, tuple);
-
- CatalogUpdateIndexes(pgrel, tuple);
+ CatalogTupleUpdate(pgrel, &tuple->t_self, tuple);
heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
namestrcpy(&((Form_pg_trigger) GETSTRUCT(tuple))->tgname,
stmt->newname);
- simple_heap_update(tgrel, &tuple->t_self, tuple);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(tgrel, tuple);
+ CatalogTupleUpdate(tgrel, &tuple->t_self, tuple);
InvokeObjectPostAlterHook(TriggerRelationId,
HeapTupleGetOid(tuple), 0);
newtrig->tgenabled = fires_when;
- simple_heap_update(tgrel, &newtup->t_self, newtup);
-
- /* Keep catalog indexes current */
- CatalogUpdateIndexes(tgrel, newtup);
+ CatalogTupleUpdate(tgrel, &newtup->t_self, newtup);
heap_freetuple(newtup);
tup = heap_form_tuple(prsRel->rd_att, values, nulls);
- prsOid = simple_heap_insert(prsRel, tup);
-
- CatalogUpdateIndexes(prsRel, tup);
+ prsOid = CatalogTupleInsert(prsRel, tup);
address = makeParserDependencies(tup);
tup = heap_form_tuple(dictRel->rd_att, values, nulls);
- dictOid = simple_heap_insert(dictRel, tup);
-
- CatalogUpdateIndexes(dictRel, tup);
+ dictOid = CatalogTupleInsert(dictRel, tup);
address = makeDictionaryDependencies(tup);
newtup = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &newtup->t_self, newtup);
-
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &newtup->t_self, newtup);
InvokeObjectPostAlterHook(TSDictionaryRelationId, dictId, 0);
tup = heap_form_tuple(tmplRel->rd_att, values, nulls);
- tmplOid = simple_heap_insert(tmplRel, tup);
-
- CatalogUpdateIndexes(tmplRel, tup);
+ tmplOid = CatalogTupleInsert(tmplRel, tup);
address = makeTSTemplateDependencies(tup);
tup = heap_form_tuple(cfgRel->rd_att, values, nulls);
- cfgOid = simple_heap_insert(cfgRel, tup);
-
- CatalogUpdateIndexes(cfgRel, tup);
+ cfgOid = CatalogTupleInsert(cfgRel, tup);
if (OidIsValid(sourceOid))
{
newmaptup = heap_form_tuple(mapRel->rd_att, mapvalues, mapnulls);
- simple_heap_insert(mapRel, newmaptup);
-
- CatalogUpdateIndexes(mapRel, newmaptup);
+ CatalogTupleInsert(mapRel, newmaptup);
heap_freetuple(newmaptup);
}
newtup = heap_modify_tuple(maptup,
RelationGetDescr(relMap),
repl_val, repl_null, repl_repl);
- simple_heap_update(relMap, &newtup->t_self, newtup);
-
- CatalogUpdateIndexes(relMap, newtup);
+ CatalogTupleUpdate(relMap, &newtup->t_self, newtup);
}
}
values[Anum_pg_ts_config_map_mapdict - 1] = ObjectIdGetDatum(dictIds[j]);
tup = heap_form_tuple(relMap->rd_att, values, nulls);
- simple_heap_insert(relMap, tup);
- CatalogUpdateIndexes(relMap, tup);
+ CatalogTupleInsert(relMap, tup);
heap_freetuple(tup);
}
new_record, new_record_nulls,
new_record_repl);
- simple_heap_update(rel, &tup->t_self, newtuple);
-
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &tup->t_self, newtuple);
/* Rebuild dependencies */
GenerateTypeDependencies(typTup->typnamespace,
*/
typTup->typnotnull = notNull;
- simple_heap_update(typrel, &tup->t_self, tup);
-
- CatalogUpdateIndexes(typrel, tup);
+ CatalogTupleUpdate(typrel, &tup->t_self, tup);
InvokeObjectPostAlterHook(TypeRelationId, domainoid, 0);
copyTuple = heap_copytuple(tuple);
copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple);
copy_con->convalidated = true;
- simple_heap_update(conrel, ©Tuple->t_self, copyTuple);
- CatalogUpdateIndexes(conrel, copyTuple);
+ CatalogTupleUpdate(conrel, ©Tuple->t_self, copyTuple);
InvokeObjectPostAlterHook(ConstraintRelationId,
HeapTupleGetOid(copyTuple), 0);
tup = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null,
repl_repl);
- simple_heap_update(rel, &tup->t_self, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
/* If it has an array type, update that too */
if (OidIsValid(typTup->typarray))
/* tup is a copy, so we can scribble directly on it */
typform->typnamespace = nspOid;
- simple_heap_update(rel, &tup->t_self, tup);
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleUpdate(rel, &tup->t_self, tup);
}
/*
/*
* Insert new record in the pg_authid table
*/
- roleid = simple_heap_insert(pg_authid_rel, tuple);
- CatalogUpdateIndexes(pg_authid_rel, tuple);
+ roleid = CatalogTupleInsert(pg_authid_rel, tuple);
/*
* Advance command counter so we can see new record; else tests in
new_tuple = heap_modify_tuple(tuple, pg_authid_dsc, new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(pg_authid_rel, &tuple->t_self, new_tuple);
-
- /* Update indexes */
- CatalogUpdateIndexes(pg_authid_rel, new_tuple);
+ CatalogTupleUpdate(pg_authid_rel, &tuple->t_self, new_tuple);
InvokeObjectPostAlterHook(AuthIdRelationId, roleid, 0);
}
newtuple = heap_modify_tuple(oldtuple, dsc, repl_val, repl_null, repl_repl);
- simple_heap_update(rel, &oldtuple->t_self, newtuple);
-
- CatalogUpdateIndexes(rel, newtuple);
+ CatalogTupleUpdate(rel, &oldtuple->t_self, newtuple);
InvokeObjectPostAlterHook(AuthIdRelationId, roleid, 0);
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(pg_authmem_rel, tuple);
+ CatalogTupleUpdate(pg_authmem_rel, &tuple->t_self, tuple);
ReleaseSysCache(authmem_tuple);
}
else
{
tuple = heap_form_tuple(pg_authmem_dsc,
new_record, new_record_nulls);
- simple_heap_insert(pg_authmem_rel, tuple);
- CatalogUpdateIndexes(pg_authmem_rel, tuple);
+ CatalogTupleInsert(pg_authmem_rel, tuple);
}
/* CCI after each change, in case there are duplicates in list */
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
- CatalogUpdateIndexes(pg_authmem_rel, tuple);
+ CatalogTupleUpdate(pg_authmem_rel, &tuple->t_self, tuple);
}
ReleaseSysCache(authmem_tuple);
values[Anum_pg_replication_origin_roname - 1] = roname_d;
tuple = heap_form_tuple(RelationGetDescr(rel), values, nulls);
- simple_heap_insert(rel, tuple);
- CatalogUpdateIndexes(rel, tuple);
+ CatalogTupleInsert(rel, tuple);
CommandCounterIncrement();
break;
}
tup = heap_modify_tuple(oldtup, RelationGetDescr(pg_rewrite_desc),
values, nulls, replaces);
- simple_heap_update(pg_rewrite_desc, &tup->t_self, tup);
+ CatalogTupleUpdate(pg_rewrite_desc, &tup->t_self, tup);
ReleaseSysCache(oldtup);
{
tup = heap_form_tuple(pg_rewrite_desc->rd_att, values, nulls);
- rewriteObjectId = simple_heap_insert(pg_rewrite_desc, tup);
+ rewriteObjectId = CatalogTupleInsert(pg_rewrite_desc, tup);
}
- /* Need to update indexes in either case */
- CatalogUpdateIndexes(pg_rewrite_desc, tup);
heap_freetuple(tup);
classForm->relminmxid = InvalidMultiXactId;
classForm->relreplident = REPLICA_IDENTITY_NOTHING;
- simple_heap_update(relationRelation, &classTup->t_self, classTup);
- CatalogUpdateIndexes(relationRelation, classTup);
+ CatalogTupleUpdate(relationRelation, &classTup->t_self, classTup);
heap_freetuple(classTup);
heap_close(relationRelation, RowExclusiveLock);
{
((Form_pg_rewrite) GETSTRUCT(ruletup))->ev_enabled =
CharGetDatum(fires_when);
- simple_heap_update(pg_rewrite_desc, &ruletup->t_self, ruletup);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(pg_rewrite_desc, ruletup);
+ CatalogTupleUpdate(pg_rewrite_desc, &ruletup->t_self, ruletup);
changed = true;
}
/* OK, do the update */
namestrcpy(&(ruleform->rulename), newName);
- simple_heap_update(pg_rewrite_desc, &ruletup->t_self, ruletup);
-
- /* keep system catalog indexes current */
- CatalogUpdateIndexes(pg_rewrite_desc, ruletup);
+ CatalogTupleUpdate(pg_rewrite_desc, &ruletup->t_self, ruletup);
heap_freetuple(ruletup);
heap_close(pg_rewrite_desc, RowExclusiveLock);
/* Do the update */
classForm->relhasrules = relHasRules;
- simple_heap_update(relationRelation, &tuple->t_self, tuple);
-
- /* Keep the catalog indexes up to date */
- CatalogUpdateIndexes(relationRelation, tuple);
+ CatalogTupleUpdate(relationRelation, &tuple->t_self, tuple);
}
else
{
replace[Anum_pg_largeobject_data - 1] = true;
newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
values, nulls, replace);
- simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
- CatalogIndexInsert(indstate, newtup);
+ CatalogTupleUpdate(lo_heap_r, &newtup->t_self, newtup);
heap_freetuple(newtup);
/*
values[Anum_pg_largeobject_pageno - 1] = Int32GetDatum(pageno);
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
newtup = heap_form_tuple(lo_heap_r->rd_att, values, nulls);
- simple_heap_insert(lo_heap_r, newtup);
- CatalogIndexInsert(indstate, newtup);
+ CatalogTupleInsert(lo_heap_r, newtup);
heap_freetuple(newtup);
}
pageno++;
replace[Anum_pg_largeobject_data - 1] = true;
newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
values, nulls, replace);
- simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
- CatalogIndexInsert(indstate, newtup);
+ CatalogTupleUpdate(lo_heap_r, &newtup->t_self, newtup);
heap_freetuple(newtup);
}
else
values[Anum_pg_largeobject_pageno - 1] = Int32GetDatum(pageno);
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
newtup = heap_form_tuple(lo_heap_r->rd_att, values, nulls);
- simple_heap_insert(lo_heap_r, newtup);
- CatalogIndexInsert(indstate, newtup);
+ CatalogTupleInsert(lo_heap_r, newtup);
heap_freetuple(newtup);
}
classform->relminmxid = minmulti;
classform->relpersistence = persistence;
- simple_heap_update(pg_class, &tuple->t_self, tuple);
- CatalogUpdateIndexes(pg_class, tuple);
+ CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
heap_freetuple(tuple);
extern void CatalogCloseIndexes(CatalogIndexState indstate);
extern void CatalogIndexInsert(CatalogIndexState indstate,
HeapTuple heapTuple);
-extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
+extern Oid CatalogTupleInsert(Relation heapRel, HeapTuple tup);
+extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid,
+ HeapTuple tup);
/*