*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.65 2000/07/04 02:40:56 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.66 2000/11/14 21:04:32 tgl Exp $
*
* NOTES
* The old interface functions have been converted to macros
return byval;
}
-#ifdef NOT_USED
-/* ----------------
- * heap_getsysattr
- * ----------------
- */
-Datum
-heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
-{
- switch (attnum)
- {
- case TableOidAttributeNumber:
- return (Datum) &tup->t_tableoid;
- case SelfItemPointerAttributeNumber:
- return (Datum) &tup->t_ctid;
- case ObjectIdAttributeNumber:
- return (Datum) (long) tup->t_oid;
- case MinTransactionIdAttributeNumber:
- return (Datum) (long) tup->t_xmin;
- case MinCommandIdAttributeNumber:
- return (Datum) (long) tup->t_cmin;
- case MaxTransactionIdAttributeNumber:
- return (Datum) (long) tup->t_xmax;
- case MaxCommandIdAttributeNumber:
- return (Datum) (long) tup->t_cmax;
- default:
- elog(ERROR, "heap_getsysattr: undefined attnum %d", attnum);
- }
- return (Datum) NULL;
-}
-
-#endif
-
/* ----------------
* nocachegetattr
*
* heap_copytuple
*
* returns a copy of an entire tuple
+ *
+ * The HeapTuple struct, tuple header, and tuple data are all allocated
+ * as a single palloc() block.
* ----------------
*/
HeapTuple
newTuple = (HeapTuple) palloc(HEAPTUPLESIZE + tuple->t_len);
newTuple->t_len = tuple->t_len;
newTuple->t_self = tuple->t_self;
+ newTuple->t_tableOid = tuple->t_tableOid;
newTuple->t_datamcxt = CurrentMemoryContext;
newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE);
- memmove((char *) newTuple->t_data,
- (char *) tuple->t_data, tuple->t_len);
+ memcpy((char *) newTuple->t_data, (char *) tuple->t_data, tuple->t_len);
return newTuple;
}
/* ----------------
* heap_copytuple_with_tuple
*
- * returns a copy of an tuple->t_data
+ * copy a tuple into a caller-supplied HeapTuple management struct
* ----------------
*/
void
dest->t_len = src->t_len;
dest->t_self = src->t_self;
+ dest->t_tableOid = src->t_tableOid;
dest->t_datamcxt = CurrentMemoryContext;
dest->t_data = (HeapTupleHeader) palloc(src->t_len);
- memmove((char *) dest->t_data,
- (char *) src->t_data, src->t_len);
- return;
+ memcpy((char *) dest->t_data, (char *) src->t_data, src->t_len);
}
#ifdef NOT_USED
tuple->t_len = len;
ItemPointerSetInvalid(&(tuple->t_self));
+ tuple->t_tableOid = InvalidOid;
td->t_natts = numberOfAttributes;
td->t_hoff = hoff;
newTuple->t_data->t_infomask = infomask;
newTuple->t_data->t_natts = numberOfAttributes;
newTuple->t_self = tuple->t_self;
+ newTuple->t_tableOid = tuple->t_tableOid;
return newTuple;
}
tuple->t_datamcxt = CurrentMemoryContext;
td = tuple->t_data = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
- MemSet((char *) td, 0, len);
-
tuple->t_len = len;
ItemPointerSetInvalid(&(tuple->t_self));
+ tuple->t_tableOid = InvalidOid;
+
+ MemSet((char *) td, 0, len);
+
td->t_hoff = hoff;
td->t_natts = natts;
td->t_infomask = 0;
td->t_infomask |= HEAP_XMAX_INVALID;
if (structlen > 0)
- memmove((char *) td + hoff, structure, (size_t) structlen);
+ memcpy((char *) td + hoff, structure, (size_t) structlen);
return tuple;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.93 2000/11/08 22:09:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.94 2000/11/14 21:04:31 tgl Exp $
*
*
* INTERFACE ROUTINES
OffsetNumber lineoff;
int linesleft;
ItemPointer tid = (tuple->t_data == NULL) ?
- (ItemPointer) NULL : &(tuple->t_self);
-
- tuple->tableOid = relation->rd_id;
+ (ItemPointer) NULL : &(tuple->t_self);
/* ----------------
* increment access statistics
if (!ItemPointerIsValid(tid))
Assert(!PointerIsValid(tid));
+
+ tuple->t_tableOid = relation->rd_id;
/* ----------------
* return null immediately if relation is empty
ItemPointer tid = &(tuple->t_self);
OffsetNumber offnum;
- tuple->tableOid = relation->rd_id;
/* ----------------
* increment access statistics
* ----------------
tuple->t_datamcxt = NULL;
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple->t_len = ItemIdGetLength(lp);
+ tuple->t_tableOid = relation->rd_id;
/* ----------------
* check time qualification of tid
bool invalidBlock,
linkend;
- tp.tableOid = relation->rd_id;
/* ----------------
* get the buffer from the relation descriptor
* Note that this does a buffer pin.
Buffer buffer;
/* increment access statistics */
- tup->tableOid = relation->rd_id;
IncrHeapAccessStat(local_insert);
IncrHeapAccessStat(global_insert);
StoreInvalidTransactionId(&(tup->t_data->t_xmax));
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
tup->t_data->t_infomask |= HEAP_XMAX_INVALID;
+ tup->t_tableOid = relation->rd_id;
#ifdef TUPLE_TOASTER_ACTIVE
/* ----------
Buffer buffer;
int result;
- tp.tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_delete);
IncrHeapAccessStat(global_delete);
tp.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tp.t_len = ItemIdGetLength(lp);
tp.t_self = *tid;
+ tp.t_tableOid = relation->rd_id;
l1:
result = HeapTupleSatisfiesUpdate(&tp);
Buffer buffer, newbuf;
int result;
- newtup->tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_replace);
IncrHeapAccessStat(global_replace);
PageHeader dp;
int result;
- tuple->tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_mark4update);
IncrHeapAccessStat(global_mark4update);
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.56 2000/08/03 19:19:38 tgl Exp $
+ * $Id: heapam.h,v 1.57 2000/11/14 21:04:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
: \
(((attnum) == TableOidAttributeNumber) ? \
( \
- (Datum)((tup)->tableOid) \
+ (Datum)((tup)->t_tableOid) \
) \
: \
( \
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.38 2000/11/14 20:47:34 tgl Exp $
+ * $Id: htup.h,v 1.39 2000/11/14 21:04:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
uint32 t_len; /* length of *t_data */
ItemPointerData t_self; /* SelfItemPointer */
- Oid tableOid; /* table the tuple came from */
+ Oid t_tableOid; /* table the tuple came from */
MemoryContext t_datamcxt; /* mcxt in which allocated */
HeapTupleHeader t_data; /* -> tuple header and data */
} HeapTupleData;