*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.108 2001/01/15 05:29:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.109 2001/01/23 04:32:20 tgl Exp $
*
*
* INTERFACE ROUTINES
/*
* heap_delete - delete a tuple
+ *
+ * NB: do not call this directly unless you are prepared to deal with
+ * concurrent-update conditions. Use simple_heap_delete instead.
*/
int
heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid)
if (result != HeapTupleMayBeUpdated)
{
Assert(result == HeapTupleSelfUpdated || result == HeapTupleUpdated);
- if (ctid != NULL)
- *ctid = tp.t_data->t_ctid;
+ *ctid = tp.t_data->t_ctid;
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
return result;
return HeapTupleMayBeUpdated;
}
+/*
+ * simple_heap_delete - delete a tuple
+ *
+ * This routine may be used to delete a tuple when concurrent updates of
+ * the target tuple are not expected (for example, because we have a lock
+ * on the relation associated with the tuple). Any failure is reported
+ * via elog().
+ */
+void
+simple_heap_delete(Relation relation, ItemPointer tid)
+{
+ ItemPointerData ctid;
+ int result;
+
+ result = heap_delete(relation, tid, &ctid);
+ switch (result)
+ {
+ case HeapTupleSelfUpdated:
+ /* Tuple was already updated in current command? */
+ elog(ERROR, "simple_heap_delete: tuple already updated by self");
+ break;
+
+ case HeapTupleMayBeUpdated:
+ /* done successfully */
+ break;
+
+ case HeapTupleUpdated:
+ elog(ERROR, "simple_heap_delete: tuple concurrently updated");
+ break;
+
+ default:
+ elog(ERROR, "Unknown status %u from heap_delete", result);
+ break;
+ }
+
+}
+
/*
* heap_update - replace a tuple
+ *
+ * NB: do not call this directly unless you are prepared to deal with
+ * concurrent-update conditions. Use simple_heap_update instead.
*/
int
heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
if (result != HeapTupleMayBeUpdated)
{
Assert(result == HeapTupleSelfUpdated || result == HeapTupleUpdated);
- if (ctid != NULL)
- *ctid = oldtup.t_data->t_ctid;
+ *ctid = oldtup.t_data->t_ctid;
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
return result;
return HeapTupleMayBeUpdated;
}
+/*
+ * simple_heap_update - replace a tuple
+ *
+ * This routine may be used to update a tuple when concurrent updates of
+ * the target tuple are not expected (for example, because we have a lock
+ * on the relation associated with the tuple). Any failure is reported
+ * via elog().
+ */
+void
+simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
+{
+ ItemPointerData ctid;
+ int result;
+
+ result = heap_update(relation, otid, tup, &ctid);
+ switch (result)
+ {
+ case HeapTupleSelfUpdated:
+ /* Tuple was already updated in current command? */
+ elog(ERROR, "simple_heap_update: tuple already updated by self");
+ break;
+
+ case HeapTupleMayBeUpdated:
+ /* done successfully */
+ break;
+
+ case HeapTupleUpdated:
+ elog(ERROR, "simple_heap_update: tuple concurrently updated");
+ break;
+
+ default:
+ elog(ERROR, "Unknown status %u from heap_update", result);
+ break;
+ }
+}
+
/*
* heap_mark4update - mark a tuple for update
*/
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.14 2001/01/15 05:29:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.15 2001/01/23 04:32:20 tgl Exp $
*
*
* INTERFACE ROUTINES
* Have a chunk, delete it
* ----------
*/
- heap_delete(toastrel, &toasttup.t_self, NULL);
+ simple_heap_delete(toastrel, &toasttup.t_self);
ReleaseBuffer(buffer);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.44 2000/11/28 23:42:31 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.45 2001/01/23 04:32:21 tgl Exp $
*
* NOTES
* See acl.h.
ReleaseSysCache(tuple);
- heap_update(relation, &newtuple->t_self, newtuple, NULL);
+ simple_heap_update(relation, &newtuple->t_self, newtuple);
/* keep the catalog indices up to date */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.156 2001/01/01 21:33:31 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.157 2001/01/23 04:32:21 tgl Exp $
*
*
* INTERFACE ROUTINES
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
{
- heap_delete(catalogRelation, &tuple->t_self, NULL);
+ simple_heap_delete(catalogRelation, &tuple->t_self);
found = true;
}
&entry);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
- heap_delete(catalogRelation, &tuple->t_self, NULL);
+ {
+ simple_heap_delete(catalogRelation, &tuple->t_self);
+ }
heap_endscan(scan);
heap_close(catalogRelation, RowExclusiveLock);
* delete the relation tuple from pg_class, and finish up.
* ----------------
*/
- heap_delete(pg_class_desc, &tup->t_self, NULL);
+ simple_heap_delete(pg_class_desc, &tup->t_self);
heap_freetuple(tup);
heap_close(pg_class_desc, RowExclusiveLock);
/*** Delete any comments associated with this attribute ***/
DeleteComments(tup->t_data->t_oid);
- heap_delete(pg_attribute_desc, &tup->t_self, NULL);
+ simple_heap_delete(pg_attribute_desc, &tup->t_self);
heap_freetuple(tup);
}
}
/* ----------------
* Ok, it's safe so we delete the relation tuple
- * from pg_type and finish up. But first end the scan so that
- * we release the read lock on pg_type. -mer 13 Aug 1991
+ * from pg_type and finish up.
* ----------------
*/
-
- heap_delete(pg_type_desc, &tup->t_self, NULL);
+ simple_heap_delete(pg_type_desc, &tup->t_self);
heap_endscan(pg_type_scan);
heap_close(pg_type_desc, RowExclusiveLock);
if (!attStruct->atthasdef)
{
attStruct->atthasdef = true;
- heap_update(attrrel, &atttup->t_self, atttup, NULL);
+ simple_heap_update(attrrel, &atttup->t_self, atttup);
/* keep catalog indices current */
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices,
attridescs);
relStruct->relchecks = numchecks;
- heap_update(relrel, &reltup->t_self, reltup, NULL);
+ simple_heap_update(relrel, &reltup->t_self, reltup);
/* keep catalog indices current */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices,
adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tup = heap_getnext(adscan, 0)))
- heap_delete(adrel, &tup->t_self, NULL);
+ {
+ simple_heap_delete(adrel, &tup->t_self);
+ }
heap_endscan(adscan);
heap_close(adrel, RowExclusiveLock);
rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tup = heap_getnext(rcscan, 0)))
- heap_delete(rcrel, &tup->t_self, NULL);
+ {
+ simple_heap_delete(rcrel, &tup->t_self);
+ }
heap_endscan(rcscan);
heap_close(rcrel, RowExclusiveLock);
scan = heap_beginscan(pgstatistic, false, SnapshotNow, 1, &key);
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
- heap_delete(pgstatistic, &tuple->t_self, NULL);
+ {
+ simple_heap_delete(pgstatistic, &tuple->t_self);
+ }
heap_endscan(scan);
heap_close(pgstatistic, RowExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.135 2001/01/18 07:29:04 inoue Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.136 2001/01/23 04:32:21 tgl Exp $
*
*
* INTERFACE ROUTINES
newtup = heap_modifytuple(tuple, pg_index, values, nulls, replace);
- heap_update(pg_index, &newtup->t_self, newtup, NULL);
+ simple_heap_update(pg_index, &newtup->t_self, newtup);
heap_freetuple(newtup);
ReleaseSysCache(tuple);
elog(ERROR, "index_drop: cache lookup failed for index %u",
indexId);
- heap_delete(relationRelation, &tuple->t_self, NULL);
+ simple_heap_delete(relationRelation, &tuple->t_self);
heap_freetuple(tuple);
/*
Int16GetDatum(attnum),
0, 0)))
{
- heap_delete(attributeRelation, &tuple->t_self, NULL);
+ simple_heap_delete(attributeRelation, &tuple->t_self);
heap_freetuple(tuple);
attnum++;
}
elog(ERROR, "index_drop: cache lookup failed for index %u",
indexId);
- heap_delete(indexRelation, &tuple->t_self, NULL);
+ simple_heap_delete(indexRelation, &tuple->t_self);
heap_freetuple(tuple);
heap_close(indexRelation, RowExclusiveLock);
}
else
{
- heap_update(pg_class, &tuple->t_self, tuple, NULL);
+ simple_heap_update(pg_class, &tuple->t_self, tuple);
/* Keep the catalog indices up to date */
if (!IsIgnoringSystemIndexes())
classTuple = heap_copytuple(&lockTupleData);
ReleaseBuffer(buffer);
((Form_pg_class) GETSTRUCT(classTuple))->relfilenode = newrelfilenode;
- heap_update(pg_class, &classTuple->t_self, classTuple, NULL);
+ simple_heap_update(pg_class, &classTuple->t_self, classTuple);
}
/* unlink old relfilenode */
DropRelationBuffers(relation);
replace[Anum_pg_class_reltuples - 1] = 'r';
values[Anum_pg_class_reltuples - 1] = (Datum) reltuples;
newtup = heap_modifytuple(tuple, pg_class, values, nulls, replace);
- heap_update(pg_class, &tuple->t_self, newtup, NULL);
+ simple_heap_update(pg_class, &tuple->t_self, newtup);
if (!IsIgnoringSystemIndexes())
{
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.5 2000/10/24 01:38:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_largeobject.c,v 1.6 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
pfree(indexRes);
if (tuple.t_data != NULL)
{
- heap_delete(pg_largeobject, &tuple.t_self, NULL);
+ simple_heap_delete(pg_largeobject, &tuple.t_self);
ReleaseBuffer(buffer);
found = true;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.53 2000/11/16 22:30:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.54 2001/01/23 04:32:21 tgl Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
nulls,
replaces);
- heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
+ simple_heap_update(pg_operator_desc, &tup->t_self, tup);
}
else
elog(ERROR, "OperatorDef: no operator %u", operatorObjectId);
nulls,
replaces);
- heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
+ simple_heap_update(pg_operator_desc, &tup->t_self, tup);
if (RelationGetForm(pg_operator_desc)->relhasindex)
{
nulls,
replaces);
- heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
+ simple_heap_update(pg_operator_desc, &tup->t_self, tup);
if (RelationGetForm(pg_operator_desc)->relhasindex)
{
nulls,
replaces);
- heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
+ simple_heap_update(pg_operator_desc, &tup->t_self, tup);
if (RelationGetForm(pg_operator_desc)->relhasindex)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.56 2000/11/16 22:30:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.57 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
nulls,
replaces);
- heap_update(pg_type_desc, &tup->t_self, tup, NULL);
+ simple_heap_update(pg_type_desc, &tup->t_self, tup);
typeObjectId = tup->t_data->t_oid;
}
namestrcpy(&(((Form_pg_type) GETSTRUCT(tuple))->typname), newTypeName);
- heap_update(pg_type_desc, &tuple->t_self, tuple, NULL);
+ simple_heap_update(pg_type_desc, &tuple->t_self, tuple);
/* update the system catalog indices */
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.11 2001/01/14 05:08:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.12 2001/01/23 04:32:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (i >= attcnt)
continue; /* don't delete it */
}
- heap_delete(pgstatistic, &tuple->t_self, NULL);
+ simple_heap_delete(pgstatistic, &tuple->t_self);
}
heap_endscan(scan);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.74 2000/12/18 17:33:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.75 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
0, 0);
if (HeapTupleIsValid(lTuple))
{
- heap_delete(lRel, &lTuple->t_self, NULL);
+ simple_heap_delete(lRel, &lTuple->t_self);
ReleaseSysCache(lTuple);
}
heap_close(lRel, AccessExclusiveLock);
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
- heap_delete(lRel, &lTuple->t_self, NULL);
+ {
+ simple_heap_delete(lRel, &lTuple->t_self);
+ }
heap_endscan(sRel);
heap_close(lRel, AccessExclusiveLock);
* just do it for any failure (certainly at least for
* EPERM too...)
*/
- heap_delete(lRel, &lTuple->t_self, NULL);
+ simple_heap_delete(lRel, &lTuple->t_self);
}
else
{
{
rTuple = heap_modifytuple(lTuple, lRel,
value, nulls, repl);
- heap_update(lRel, &lTuple->t_self, rTuple, NULL);
+ simple_heap_update(lRel, &lTuple->t_self, rTuple);
if (RelationGetForm(lRel)->relhasindex)
{
Relation idescs[Num_pg_listener_indices];
NotifyMyFrontEnd(relname, sourcePID);
/* Rewrite the tuple with 0 in notification column */
rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl);
- heap_update(lRel, &lTuple->t_self, rTuple, NULL);
+ simple_heap_update(lRel, &lTuple->t_self, rTuple);
if (RelationGetForm(lRel)->relhasindex)
{
Relation idescs[Num_pg_listener_indices];
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.117 2001/01/23 01:48:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.118 2001/01/23 04:32:22 tgl Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
newreltup = heap_copytuple(reltup);
((Form_pg_class) GETSTRUCT(newreltup))->relnatts = maxatts;
- heap_update(rel, &newreltup->t_self, newreltup, NULL);
+ simple_heap_update(rel, &newreltup->t_self, newreltup);
/* keep catalog indices current */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
/* update to false */
newtuple = heap_copytuple(tuple);
((Form_pg_attribute) GETSTRUCT(newtuple))->atthasdef = FALSE;
- heap_update(attr_rel, &tuple->t_self, newtuple, NULL);
+ simple_heap_update(attr_rel, &tuple->t_self, newtuple);
/* keep the system catalog indices current */
CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, irelations);
Int16GetDatum(attnum));
scan = heap_beginscan(attrdef_rel, false, SnapshotNow, 2, scankeys);
- AssertState(scan != NULL);
if (HeapTupleIsValid(tuple = heap_getnext(scan, 0)))
- heap_delete(attrdef_rel, &tuple->t_self, NULL);
+ simple_heap_delete(attrdef_rel, &tuple->t_self);
heap_endscan(scan);
}
else
{
- heap_delete(rcrel, &htup->t_self, NULL);
+ simple_heap_delete(rcrel, &htup->t_self);
pgcform->relchecks--;
}
}
namestrcpy(&(attribute->attname), dropColname);
ATTRIBUTE_DROP_COLUMN(attribute);
- heap_update(attrdesc, &tup->t_self, tup, NULL);
+ simple_heap_update(attrdesc, &tup->t_self, tup);
hasindex = (!IsIgnoringSystemIndexes() && RelationGetForm(attrdesc)->relhasindex);
if (hasindex)
{
{
if (((Form_pg_attrdef) GETSTRUCT(tup))->adnum == attnum)
{
- heap_delete(adrel, &tup->t_self, NULL);
+ simple_heap_delete(adrel, &tup->t_self);
break;
}
}
RemoveColumnReferences(myrelid, attnum, false, reltup);
/* update pg_class tuple */
- heap_update(rel, &reltup->t_self, reltup, NULL);
+ simple_heap_update(rel, &reltup->t_self, reltup);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, rel, reltup);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
*/
((Form_pg_class) GETSTRUCT(tuple))->relowner = newOwnerSysid;
- heap_update(class_rel, &tuple->t_self, tuple, NULL);
+ simple_heap_update(class_rel, &tuple->t_self, tuple);
/* Keep the catalog indices up to date */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
*/
((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid = toast_relid;
((Form_pg_class) GETSTRUCT(reltup))->reltoastidxid = toast_idxid;
- heap_update(class_rel, &reltup->t_self, reltup, NULL);
+ simple_heap_update(class_rel, &reltup->t_self, reltup);
/*
* Keep catalog indices current
*
* Copyright (c) 1999, PostgreSQL Global Development Group
*
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.26 2001/01/23 04:32:21 tgl Exp $
+ *
*-------------------------------------------------------------------------
*/
if (HeapTupleIsValid(searchtuple))
{
- /*** If the comment is blank, call heap_delete, else heap_update ***/
+ /*** If the comment is blank, delete old entry, else update it ***/
if ((comment == NULL) || (strlen(comment) == 0))
- heap_delete(description, &searchtuple->t_self, NULL);
+ simple_heap_delete(description, &searchtuple->t_self);
else
{
desctuple = heap_modifytuple(searchtuple, description, values,
nulls, replaces);
- heap_update(description, &searchtuple->t_self, desctuple, NULL);
+ simple_heap_update(description, &searchtuple->t_self, desctuple);
modified = TRUE;
}
/*** If a previous tuple exists, delete it ***/
if (HeapTupleIsValid(searchtuple))
- heap_delete(description, &searchtuple->t_self, NULL);
+ simple_heap_delete(description, &searchtuple->t_self);
/*** Complete the scan, update indices, if necessary ***/
Oid oid;
bool superuser;
int32 dba;
- Oid userid;
+ Oid userid;
/*** First find the tuple in pg_database for the database ***/
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.70 2001/01/05 02:58:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.71 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
elog(ERROR, "setRelhassubclassInRelation: cache lookup failed for relation %u", relationId);
((Form_pg_class) GETSTRUCT(tuple))->relhassubclass = relhassubclass;
- heap_update(relationRelation, &tuple->t_self, tuple, NULL);
+ simple_heap_update(relationRelation, &tuple->t_self, tuple);
/* keep the catalog indices up to date */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.71 2001/01/14 22:14:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.72 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
/* Remove the database's tuple from pg_database */
- heap_delete(pgdbrel, &tup->t_self, NULL);
+ simple_heap_delete(pgdbrel, &tup->t_self);
heap_endscan(pgdbscan);
elog(ERROR, "Language %s isn't a created procedural language",
languageName);
- heap_delete(rel, &langTup->t_self, NULL);
+ simple_heap_delete(rel, &langTup->t_self);
heap_freetuple(langTup);
heap_close(rel, RowExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.57 2000/12/15 04:08:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.58 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
DeleteComments(tup->t_data->t_oid);
- heap_delete(relation, &tup->t_self, NULL);
+ simple_heap_delete(relation, &tup->t_self);
}
else
DeleteComments(tup->t_data->t_oid);
- heap_delete(rel, &tup->t_self, NULL);
-
+ simple_heap_delete(rel, &tup->t_self);
}
heap_endscan(scan);
DeleteComments(typeOid);
- heap_delete(relation, &tup->t_self, NULL);
+ simple_heap_delete(relation, &tup->t_self);
ReleaseSysCache(tup);
if (!HeapTupleIsValid(tup))
elog(ERROR, "RemoveType: type '%s' does not exist", shadow_type);
- heap_delete(relation, &tup->t_self, NULL);
+ simple_heap_delete(relation, &tup->t_self);
ReleaseSysCache(tup);
DeleteComments(tup->t_data->t_oid);
- heap_delete(relation, &tup->t_self, NULL);
+ simple_heap_delete(relation, &tup->t_self);
ReleaseSysCache(tup);
DeleteComments(tup->t_data->t_oid);
- heap_delete(relation, &tup->t_self, NULL);
+ simple_heap_delete(relation, &tup->t_self);
ReleaseSysCache(tup);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.53 2000/11/16 22:30:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.54 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
StrNCpy(NameStr(((Form_pg_attribute) GETSTRUCT(atttup))->attname),
newattname, NAMEDATALEN);
- heap_update(attrelation, &atttup->t_self, atttup, NULL);
+ simple_heap_update(attrelation, &atttup->t_self, atttup);
/* keep system catalog indices current */
{
StrNCpy(NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
newrelname, NAMEDATALEN);
- heap_update(relrelation, &reltup->t_self, reltup, NULL);
+ simple_heap_update(relrelation, &reltup->t_self, reltup);
/* keep the system catalog indices current */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, irelations);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.83 2001/01/22 00:50:07 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.84 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
stmt->relname);
((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found + 1;
- heap_update(pgrel, &tuple->t_self, tuple, NULL);
+ simple_heap_update(pgrel, &tuple->t_self, tuple);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
DeleteComments(tuple->t_data->t_oid);
- heap_delete(tgrel, &tuple->t_self, NULL);
+ simple_heap_delete(tgrel, &tuple->t_self);
tgfound++;
}
else
stmt->relname);
((Form_pg_class) GETSTRUCT(tuple))->reltriggers = found;
- heap_update(pgrel, &tuple->t_self, tuple, NULL);
+ simple_heap_update(pgrel, &tuple->t_self, tuple);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
DeleteComments(tup->t_data->t_oid);
- heap_delete(tgrel, &tup->t_self, NULL);
+ simple_heap_delete(tgrel, &tup->t_self);
found = true;
}
RelationGetRelid(rel));
((Form_pg_class) GETSTRUCT(tup))->reltriggers = 0;
- heap_update(pgrel, &tup->t_self, tup, NULL);
+ simple_heap_update(pgrel, &tup->t_self, tup);
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tup);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.71 2001/01/17 17:26:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.72 2001/01/23 04:32:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
new_tuple = heap_formtuple(pg_shadow_dsc, new_record, new_record_nulls);
- Assert(new_tuple);
- /* XXX check return value of this? */
- heap_update(pg_shadow_rel, &tuple->t_self, new_tuple, NULL);
-
+ simple_heap_update(pg_shadow_rel, &tuple->t_self, new_tuple);
/* Update indexes */
if (RelationGetForm(pg_shadow_rel)->relhasindex)
/*
* Remove the user from the pg_shadow table
*/
- heap_delete(pg_shadow_rel, &tuple->t_self, NULL);
+ simple_heap_delete(pg_shadow_rel, &tuple->t_self);
ReleaseSysCache(tuple);
new_record[Anum_pg_group_grolist - 1] = PointerGetDatum(newarray);
tuple = heap_formtuple(pg_group_dsc, new_record, new_record_nulls);
- heap_update(pg_group_rel, &group_tuple->t_self, tuple, NULL);
+ simple_heap_update(pg_group_rel, &group_tuple->t_self, tuple);
/* Update indexes */
if (RelationGetForm(pg_group_rel)->relhasindex)
new_record[Anum_pg_group_grolist - 1] = PointerGetDatum(newarray);
tuple = heap_formtuple(pg_group_dsc, new_record, new_record_nulls);
- heap_update(pg_group_rel, &group_tuple->t_self, tuple, NULL);
+ simple_heap_update(pg_group_rel, &group_tuple->t_self, tuple);
/* Update indexes */
if (RelationGetForm(pg_group_rel)->relhasindex)
if (datum && !null && strcmp((char *) datum, stmt->name) == 0)
{
gro_exists = true;
- heap_delete(pg_group_rel, &tuple->t_self, NULL);
+ simple_heap_delete(pg_group_rel, &tuple->t_self);
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.41 2000/11/16 22:30:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.42 2001/01/23 04:32:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Now delete the pg_rewrite tuple for the rule
*/
- heap_delete(RewriteRelation, &tuple->t_self, NULL);
+ simple_heap_delete(RewriteRelation, &tuple->t_self);
heap_freetuple(tuple);
DeleteComments(tuple->t_data->t_oid);
- heap_delete(RewriteRelation, &tuple->t_self, NULL);
-
+ simple_heap_delete(RewriteRelation, &tuple->t_self);
}
heap_endscan(scanDesc);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.45 2000/11/16 22:30:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.46 2001/01/23 04:32:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (relIsBecomingView)
((Form_pg_class) GETSTRUCT(tuple))->relkind = RELKIND_VIEW;
- heap_update(relationRelation, &tuple->t_self, tuple, NULL);
+ simple_heap_update(relationRelation, &tuple->t_self, tuple);
/* Keep the catalog indices up to date */
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.82 2001/01/21 03:50:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.83 2001/01/23 04:32:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
replace[Anum_pg_largeobject_data - 1] = 'r';
newtup = heap_modifytuple(&oldtuple, obj_desc->heap_r,
values, nulls, replace);
- heap_update(obj_desc->heap_r, &newtup->t_self, newtup, NULL);
+ simple_heap_update(obj_desc->heap_r, &newtup->t_self, newtup);
if (write_indices)
CatalogIndexInsert(idescs, Num_pg_largeobject_indices,
obj_desc->heap_r, newtup);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.34 2000/11/16 22:30:31 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.35 2001/01/23 04:32:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
replNull,
repl);
- heap_update(procrel, &newtup->t_self, newtup, NULL);
+ simple_heap_update(procrel, &newtup->t_self, newtup);
setoid = newtup->t_data->t_oid;
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.60 2000/12/27 23:59:13 tgl Exp $
+ * $Id: heapam.h,v 1.61 2001/01/23 04:32:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
ItemPointer ctid);
extern int heap_mark4update(Relation relation, HeapTuple tup, Buffer *userbuf);
+extern void simple_heap_delete(Relation relation, ItemPointer tid);
+extern void simple_heap_update(Relation relation, ItemPointer otid,
+ HeapTuple tup);
extern void heap_markpos(HeapScanDesc scan);
extern void heap_restrpos(HeapScanDesc scan);