1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* tuptable.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* tuple table support stuff
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2001-10-25 07:50:21 +02:00
|
|
|
* $Id: tuptable.h,v 1.19 2001/10/25 05:49:59 momjian Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
1997-09-07 07:04:48 +02:00
|
|
|
* The tuple table interface is getting pretty ugly.
|
|
|
|
* It should be redesigned soon.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef TUPTABLE_H
|
|
|
|
#define TUPTABLE_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "access/htup.h"
|
1996-10-23 09:42:13 +02:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/* ----------------
|
1999-02-23 08:36:31 +01:00
|
|
|
* The executor tuple table is managed and manipulated by special
|
2001-01-29 01:39:20 +01:00
|
|
|
* code in executor/execTuples.c.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* TupleTableSlot information
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2001-01-29 01:39:20 +01:00
|
|
|
* val current tuple, or NULL if no tuple
|
|
|
|
* shouldFree boolean - should we pfree() tuple
|
1997-09-07 07:04:48 +02:00
|
|
|
* descIsNew boolean - true when tupleDescriptor changes
|
2001-01-29 01:39:20 +01:00
|
|
|
* tupleDescriptor type information for the tuple data
|
|
|
|
* shouldFreeDesc boolean - should we free tupleDescriptor
|
1997-09-07 07:04:48 +02:00
|
|
|
* buffer the buffer for tuples pointing to disk pages
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* The executor stores pointers to tuples in a ``tuple table''
|
2001-01-29 01:39:20 +01:00
|
|
|
* which is composed of TupleTableSlots. Sometimes the tuples
|
|
|
|
* are pointers to buffer pages, while others are pointers to
|
|
|
|
* palloc'ed memory; the shouldFree variable tells us when
|
1997-09-07 07:04:48 +02:00
|
|
|
* we may call pfree() on a tuple. -cim 9/23/90
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2001-01-29 01:39:20 +01:00
|
|
|
* If buffer is not InvalidBuffer, then the slot is holding a pin
|
|
|
|
* on the indicated buffer page; drop the pin when we release the
|
|
|
|
* slot's reference to that buffer.
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* In the implementation of nested-dot queries such as
|
|
|
|
* "retrieve (EMP.hobbies.all)", a single scan may return tuples
|
|
|
|
* of many types, so now we return pointers to tuple descriptors
|
|
|
|
* along with tuples returned via the tuple table. -cim 1/18/90
|
1999-02-23 08:36:31 +01:00
|
|
|
*
|
2001-01-29 01:39:20 +01:00
|
|
|
* shouldFreeDesc is similar to shouldFree: if it's true, then the
|
|
|
|
* tupleDescriptor is "owned" by the TupleTableSlot and should be
|
|
|
|
* freed when the slot's reference to the descriptor is dropped.
|
|
|
|
*
|
1999-02-23 08:36:31 +01:00
|
|
|
* See executor.h for decls of functions defined in execTuples.c
|
|
|
|
* -jolly
|
|
|
|
*
|
1996-07-09 08:22:35 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct TupleTableSlot
|
|
|
|
{
|
1999-05-25 18:15:34 +02:00
|
|
|
NodeTag type;
|
|
|
|
HeapTuple val;
|
|
|
|
bool ttc_shouldFree;
|
|
|
|
bool ttc_descIsNew;
|
2001-01-29 01:39:20 +01:00
|
|
|
bool ttc_shouldFreeDesc;
|
1999-05-25 18:15:34 +02:00
|
|
|
TupleDesc ttc_tupleDescriptor;
|
|
|
|
Buffer ttc_buffer;
|
1997-09-08 23:56:23 +02:00
|
|
|
} TupleTableSlot;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* tuple table data structure
|
1996-07-09 08:22:35 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct TupleTableData
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
int size; /* size of the table */
|
|
|
|
int next; /* next available slot number */
|
1997-09-07 07:04:48 +02:00
|
|
|
TupleTableSlot *array; /* array of TupleTableSlot's */
|
1997-09-08 23:56:23 +02:00
|
|
|
} TupleTableData;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
typedef TupleTableData *TupleTable;
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* TUPTABLE_H */
|