Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / include / utils / snapshot.h
blobdf79e3aedb915f6eade6589697982155070fed51
1 /*-------------------------------------------------------------------------
3 * snapshot.h
4 * POSTGRES snapshot definition
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $PostgreSQL$
11 *-------------------------------------------------------------------------
13 #ifndef SNAPSHOT_H
14 #define SNAPSHOT_H
16 #include "access/htup.h"
17 #include "storage/buf.h"
20 typedef struct SnapshotData *Snapshot;
22 #define InvalidSnapshot ((Snapshot) NULL)
25 * We use SnapshotData structures to represent both "regular" (MVCC)
26 * snapshots and "special" snapshots that have non-MVCC semantics.
27 * The specific semantics of a snapshot are encoded by the "satisfies"
28 * function.
30 typedef bool (*SnapshotSatisfiesFunc) (HeapTupleHeader tuple,
31 Snapshot snapshot, Buffer buffer);
33 typedef struct SnapshotData
35 SnapshotSatisfiesFunc satisfies; /* tuple test function */
38 * The remaining fields are used only for MVCC snapshots, and are normally
39 * just zeroes in special snapshots. (But xmin and xmax are used
40 * specially by HeapTupleSatisfiesDirty.)
42 * An MVCC snapshot can never see the effects of XIDs >= xmax. It can see
43 * the effects of all older XIDs except those listed in the snapshot. xmin
44 * is stored as an optimization to avoid needing to search the XID arrays
45 * for most tuples.
47 TransactionId xmin; /* all XID < xmin are visible to me */
48 TransactionId xmax; /* all XID >= xmax are invisible to me */
49 uint32 xcnt; /* # of xact ids in xip[] */
50 TransactionId *xip; /* array of xact IDs in progress */
51 /* note: all ids in xip[] satisfy xmin <= xip[i] < xmax */
52 int32 subxcnt; /* # of xact ids in subxip[], -1 if overflow */
53 TransactionId *subxip; /* array of subxact IDs in progress */
56 * note: all ids in subxip[] are >= xmin, but we don't bother filtering
57 * out any that are >= xmax
59 CommandId curcid; /* in my xact, CID < curcid are visible */
60 uint32 active_count; /* refcount on ActiveSnapshot stack */
61 uint32 regd_count; /* refcount on RegisteredSnapshotList */
62 bool copied; /* false if it's a static snapshot */
63 } SnapshotData;
66 * Result codes for HeapTupleSatisfiesUpdate. This should really be in
67 * tqual.h, but we want to avoid including that file elsewhere.
69 typedef enum
71 HeapTupleMayBeUpdated,
72 HeapTupleInvisible,
73 HeapTupleSelfUpdated,
74 HeapTupleUpdated,
75 HeapTupleBeingUpdated
76 } HTSU_Result;
78 #endif /* SNAPSHOT_H */