1 /*-------------------------------------------------------------------------
4 * Generalized routines for temporary tuple storage.
6 * This module handles temporary storage of tuples for purposes such
7 * as Materialize nodes, hashjoin batch files, etc. It is essentially
8 * a dumbed-down version of tuplesort.c; it does no sorting of tuples
9 * but can only store a sequence of tuples and regurgitate it later.
10 * A temporary file is used to handle the data if it exceeds the
11 * space limit specified by the caller.
13 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
14 * Portions Copyright (c) 1994, Regents of the University of California
16 * $Id: tuplestore.h,v 1.3 2001/03/22 04:01:15 momjian Exp $
18 *-------------------------------------------------------------------------
23 #include "access/htup.h"
25 /* Tuplestorestate is an opaque type whose details are not known outside
28 typedef struct Tuplestorestate Tuplestorestate;
31 * Currently we only need to store HeapTuples, but it would be easy
32 * to support the same behavior for IndexTuples and/or bare Datums.
35 extern Tuplestorestate *tuplestore_begin_heap(bool randomAccess,
38 extern void tuplestore_puttuple(Tuplestorestate *state, void *tuple);
40 extern void tuplestore_donestoring(Tuplestorestate *state);
42 extern void *tuplestore_gettuple(Tuplestorestate *state, bool forward,
45 #define tuplestore_getheaptuple(state, forward, should_free) \
46 ((HeapTuple) tuplestore_gettuple(state, forward, should_free))
48 extern void tuplestore_end(Tuplestorestate *state);
51 * These routines may only be called if randomAccess was specified 'true'.
52 * Likewise, backwards scan in gettuple/getdatum is only allowed if
53 * randomAccess was specified.
56 extern void tuplestore_rescan(Tuplestorestate *state);
57 extern void tuplestore_markpos(Tuplestorestate *state);
58 extern void tuplestore_restorepos(Tuplestorestate *state);
60 #endif /* TUPLESTORE_H */