1996-08-27 23:50:29 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* htup.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES heap tuple definitions.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-01-31 05:39:26 +01:00
|
|
|
* $Id: htup.h,v 1.8 1998/01/31 04:39:22 momjian Exp $
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef HTUP_H
|
1996-08-27 23:50:29 +02:00
|
|
|
#define HTUP_H
|
|
|
|
|
1996-11-04 08:18:46 +01:00
|
|
|
#include <utils/nabstime.h>
|
|
|
|
#include <storage/itemptr.h>
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
#define MinHeapTupleBitmapSize 32 /* 8 * 4 */
|
|
|
|
|
|
|
|
/* check these, they are likely to be more severely limited by t_hoff */
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define MaxHeapAttributeNumber 1600 /* 8 * 200 */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* to avoid wasting space, the attributes should be layed out in such a
|
|
|
|
* way to reduce structure padding.
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct HeapTupleData
|
|
|
|
{
|
1997-11-02 16:27:14 +01:00
|
|
|
unsigned int t_len; /* length of entire tuple */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
Oid t_oid; /* OID of this tuple -- 4 bytes */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
CommandId t_cmin; /* insert CID stamp -- 4 bytes each */
|
|
|
|
CommandId t_cmax; /* delete CommandId stamp */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
|
|
|
|
TransactionId t_xmax; /* delete XID stamp */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
ItemPointerData t_ctid; /* current TID of this tuple */
|
|
|
|
|
|
|
|
int16 t_natts; /* number of attributes */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
uint16 t_infomask; /* various infos */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
uint8 t_hoff; /* sizeof tuple header */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-11-02 16:27:14 +01:00
|
|
|
bits8 t_bits[MinHeapTupleBitmapSize / 8];
|
1997-09-07 07:04:48 +02:00
|
|
|
/* bit map of domains */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/* MORE DATA FOLLOWS AT END OF STRUCT */
|
1997-09-08 23:56:23 +02:00
|
|
|
} HeapTupleData;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef HeapTupleData *HeapTuple;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define SelfItemPointerAttributeNumber (-1)
|
|
|
|
#define ObjectIdAttributeNumber (-2)
|
|
|
|
#define MinTransactionIdAttributeNumber (-3)
|
|
|
|
#define MinCommandIdAttributeNumber (-4)
|
|
|
|
#define MaxTransactionIdAttributeNumber (-5)
|
|
|
|
#define MaxCommandIdAttributeNumber (-6)
|
1997-11-02 16:27:14 +01:00
|
|
|
#define FirstLowInvalidHeapAttributeNumber (-7)
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1998-01-31 05:39:26 +01:00
|
|
|
/* If you make any changes above, the order off offsets in this must change */
|
|
|
|
extern long heap_sysoffset[];
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* support macros
|
1996-08-27 23:50:29 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
#define GETSTRUCT(TUP) (((char *)(TUP)) + ((HeapTuple)(TUP))->t_hoff)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1997-09-07 07:04:48 +02:00
|
|
|
* BITMAPLEN(NATTS) -
|
|
|
|
* Computes minimum size of bitmap given number of domains.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
|
|
|
#define BITMAPLEN(NATTS) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((((((int)(NATTS) - 1) >> 3) + 4 - (MinHeapTupleBitmapSize >> 3)) \
|
|
|
|
& ~03) + (MinHeapTupleBitmapSize >> 3))
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* HeapTupleIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the heap tuple is valid.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define HeapTupleIsValid(tuple) PointerIsValid(tuple)
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* information stored in t_infomask:
|
|
|
|
*/
|
1997-11-02 16:27:14 +01:00
|
|
|
#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
|
|
|
|
#define HEAP_HASVARLENA 0x0002 /* has variable length
|
1997-09-07 07:04:48 +02:00
|
|
|
* attribute(s) */
|
1997-11-02 16:27:14 +01:00
|
|
|
#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
|
|
|
|
#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
|
|
|
|
#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
|
|
|
|
#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
|
|
|
|
|
|
|
|
#define HEAP_XACT_MASK 0x0F00 /* */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
#define HeapTupleNoNulls(tuple) \
|
1997-09-07 07:04:48 +02:00
|
|
|
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASNULL))
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
#define HeapTupleAllFixed(tuple) \
|
1997-09-07 07:04:48 +02:00
|
|
|
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASVARLENA))
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* HTUP_H */
|