1996-08-27 23:50:29 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* itup.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES index tuple definitions.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-01-24 23:50:57 +01:00
|
|
|
* $Id: itup.h,v 1.9 1998/01/24 22:48:06 momjian Exp $
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef ITUP_H
|
|
|
|
#define ITUP_H
|
|
|
|
|
1996-11-05 08:20:09 +01:00
|
|
|
#include <access/tupdesc.h>
|
|
|
|
#include <storage/itemptr.h>
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define MaxIndexAttributeNumber 7
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct IndexTupleData
|
|
|
|
{
|
|
|
|
ItemPointerData t_tid; /* reference TID to base tuple */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* t_info is layed out in the following fashion:
|
|
|
|
*
|
|
|
|
* 15th (leftmost) bit: "has nulls" bit 14th bit: "has varlenas" bit 13th
|
|
|
|
* bit: "has rules" bit - (removed ay 11/94) bits 12-0 bit: size of
|
|
|
|
* tuple.
|
|
|
|
*/
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
unsigned short t_info; /* various info about tuple */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* please make sure sizeof(IndexTupleData) is MAXALIGN'ed. See
|
|
|
|
* IndexInfoFindDataOffset() for the reason.
|
|
|
|
*/
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-08 23:56:23 +02:00
|
|
|
} IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef IndexTupleData *IndexTuple;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
typedef struct InsertIndexResultData
|
|
|
|
{
|
|
|
|
ItemPointerData pointerData;
|
1997-09-08 23:56:23 +02:00
|
|
|
} InsertIndexResultData;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
typedef InsertIndexResultData *InsertIndexResult;
|
|
|
|
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct RetrieveIndexResultData
|
|
|
|
{
|
|
|
|
ItemPointerData index_iptr;
|
|
|
|
ItemPointerData heap_iptr;
|
1997-09-08 23:56:23 +02:00
|
|
|
} RetrieveIndexResultData;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef RetrieveIndexResultData *RetrieveIndexResult;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*-----------------
|
|
|
|
* PredInfo -
|
1997-09-07 07:04:48 +02:00
|
|
|
* used for partial indices
|
1996-08-27 23:50:29 +02:00
|
|
|
*-----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct PredInfo
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Node *pred;
|
|
|
|
Node *oldPred;
|
1997-09-08 23:56:23 +02:00
|
|
|
} PredInfo;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* externs
|
1996-08-27 23:50:29 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define INDEX_SIZE_MASK 0x1FFF
|
|
|
|
#define INDEX_NULL_MASK 0x8000
|
1997-09-07 07:04:48 +02:00
|
|
|
#define INDEX_VAR_MASK 0x4000
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define IndexTupleSize(itup) (((IndexTuple) (itup))->t_info & 0x1FFF)
|
|
|
|
#define IndexTupleDSize(itup) ((itup).t_info & 0x1FFF)
|
1996-08-27 23:50:29 +02:00
|
|
|
#define IndexTupleNoNulls(itup) (!(((IndexTuple) (itup))->t_info & 0x8000))
|
|
|
|
#define IndexTupleAllFixed(itup) (!(((IndexTuple) (itup))->t_info & 0x4000))
|
|
|
|
|
|
|
|
#define IndexTupleHasMinHeader(itup) (IndexTupleNoNulls(itup))
|
|
|
|
|
|
|
|
|
|
|
|
/* indextuple.h */
|
1998-01-24 23:50:57 +01:00
|
|
|
extern IndexTuple index_formtuple(TupleDesc tupleDescriptor,
|
1997-09-07 07:04:48 +02:00
|
|
|
Datum value[], char null[]);
|
1998-01-24 23:50:57 +01:00
|
|
|
extern Datum index_getattr(IndexTuple tuple, AttrNumber attNum,
|
1997-09-08 23:56:23 +02:00
|
|
|
TupleDesc tupDesc, bool *isNullOutP);
|
1998-01-24 23:50:57 +01:00
|
|
|
extern RetrieveIndexResult FormRetrieveIndexResult(ItemPointer indexItemPointer,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer heapItemPointer);
|
1997-09-08 23:56:23 +02:00
|
|
|
extern void CopyIndexTuple(IndexTuple source, IndexTuple *target);
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* ITUP_H */
|