summaryrefslogtreecommitdiff
path: root/src/backend/access/common/heaptuple.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-08-19 02:04:17 +0000
committerBruce Momjian <bruce@momjian.us>1998-08-19 02:04:17 +0000
commit7971539020a344dce3a8b3b9b93ff4f10e2f823a (patch)
tree8dca0af0d3ac8d431bff8c0dec793fe9733a1ee9 /src/backend/access/common/heaptuple.c
parent31de2c9461dff3284ad61084c73eba093fa3f68e (diff)
downloadpostgresql-7971539020a344dce3a8b3b9b93ff4f10e2f823a.tar.gz
heap_fetch requires buffer pointer, must be released; heap_getnext
no longer returns buffer pointer, can be gotten from scan; descriptor; bootstrap can create multi-key indexes; pg_procname index now is multi-key index; oidint2, oidint4, oidname are gone (must be removed from regression tests); use System Cache rather than sequential scan in many places; heap_modifytuple no longer takes buffer parameter; remove unused buffer parameter in a few other functions; oid8 is not index-able; remove some use of single-character variable names; cleanup Buffer variables usage and scan descriptor looping; cleaned up allocation and freeing of tuples; 18k lines of diff;
Diffstat (limited to 'src/backend/access/common/heaptuple.c')
-rw-r--r--src/backend/access/common/heaptuple.c46
1 files changed, 5 insertions, 41 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index ec5b756e74..cade50db3c 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.38 1998/06/15 19:27:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.39 1998/08/19 02:00:53 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -736,13 +736,6 @@ heap_copytuple(HeapTuple tuple)
if (!HeapTupleIsValid(tuple))
return (NULL);
- /* XXX For now, just prevent an undetectable executor related error */
- if (tuple->t_len > MAXTUPLEN)
- {
- elog(ERROR, "palloctup: cannot handle length %d tuples",
- tuple->t_len);
- }
-
newTuple = (HeapTuple) palloc(tuple->t_len);
memmove((char *) newTuple, (char *) tuple, (int) tuple->t_len);
return (newTuple);
@@ -863,11 +856,11 @@ heap_formtuple(TupleDesc tupleDescriptor,
* heap_modifytuple
*
* forms a new tuple from an old tuple and a set of replacement values.
+ * returns a new palloc'ed tuple.
* ----------------
*/
HeapTuple
heap_modifytuple(HeapTuple tuple,
- Buffer buffer,
Relation relation,
Datum replValue[],
char replNull[],
@@ -879,7 +872,6 @@ heap_modifytuple(HeapTuple tuple,
char *nulls;
bool isNull;
HeapTuple newTuple;
- int madecopy;
uint8 infomask;
/* ----------------
@@ -887,26 +879,11 @@ heap_modifytuple(HeapTuple tuple,
* ----------------
*/
Assert(HeapTupleIsValid(tuple));
- Assert(BufferIsValid(buffer) || RelationIsValid(relation));
- Assert(HeapTupleIsValid(tuple));
+ Assert(RelationIsValid(relation));
Assert(PointerIsValid(replValue));
Assert(PointerIsValid(replNull));
Assert(PointerIsValid(repl));
- /* ----------------
- * if we're pointing to a disk page, then first
- * make a copy of our tuple so that all the attributes
- * are available. XXX this is inefficient -cim
- * ----------------
- */
- madecopy = 0;
- if (BufferIsValid(buffer) == true)
- {
- relation = (Relation) BufferGetRelation(buffer);
- tuple = heap_copytuple(tuple);
- madecopy = 1;
- }
-
numberOfAttributes = RelationGetRelationTupleForm(relation)->relnatts;
/* ----------------
@@ -933,10 +910,7 @@ heap_modifytuple(HeapTuple tuple,
}
else if (repl[attoff] != 'r')
- {
elog(ERROR, "heap_modifytuple: repl is \\%3d", repl[attoff]);
-
- }
else
{ /* == 'r' */
value[attoff] = replValue[attoff];
@@ -961,18 +935,8 @@ heap_modifytuple(HeapTuple tuple,
(char *) &tuple->t_oid,
((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask;
- newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
- * case */
-
- /* ----------------
- * if we made a copy of the tuple, then free it.
- * ----------------
- */
- if (madecopy)
- pfree(tuple);
-
- return
- newTuple;
+ newTuple->t_natts = numberOfAttributes; /* fix t_natts just in case */
+ return newTuple;
}
/* ----------------------------------------------------------------