summaryrefslogtreecommitdiff
path: root/src/include/utils/tqual.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-09-11 18:28:34 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-09-11 18:28:34 +0000
commit493f72606b463a75ae4e2ee4e64d829e7f56066d (patch)
tree8645b7d58f6e333f4d10948051be2bd7e38002be /src/include/utils/tqual.h
parent9835944e54ace63b040d2d2e78eaa0b78aca1bed (diff)
Renumber SnapshotNow and the other special snapshot codes so that
((Snapshot) NULL) can no longer be confused with a valid snapshot, as per my recent suggestion. Define a macro InvalidSnapshot for 0. Use InvalidSnapshot instead of SnapshotAny as the do-nothing special case for heap_update and heap_delete crosschecks; this seems a little cleaner even though the behavior is really the same.
Diffstat (limited to 'src/include/utils/tqual.h')
-rw-r--r--src/include/utils/tqual.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h
index e378e444da1..627bcaf75a1 100644
--- a/src/include/utils/tqual.h
+++ b/src/include/utils/tqual.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.50 2004/08/29 04:13:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.51 2004/09/11 18:28:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,6 +19,20 @@
#include "access/xact.h"
+/*
+ * "Regular" snapshots are pointers to a SnapshotData structure.
+ *
+ * We also have some "special" snapshot values that have fixed meanings
+ * and don't need any backing SnapshotData. These are encoded by small
+ * integer values, which of course is a gross violation of ANSI C, but
+ * it works fine on all known platforms.
+ *
+ * SnapshotDirty is an even more special case: its semantics are fixed,
+ * but there is a backing SnapshotData struct for it. That struct is
+ * actually used as *output* data from tqual.c, not input into it.
+ * (But hey, SnapshotDirty ought to have a dirty implementation, no? ;-))
+ */
+
typedef struct SnapshotData
{
TransactionId xmin; /* XID < xmin are visible to me */
@@ -32,10 +46,12 @@ typedef struct SnapshotData
typedef SnapshotData *Snapshot;
-#define SnapshotNow ((Snapshot) 0x0)
-#define SnapshotSelf ((Snapshot) 0x1)
-#define SnapshotAny ((Snapshot) 0x2)
-#define SnapshotToast ((Snapshot) 0x3)
+/* Special snapshot values: */
+#define InvalidSnapshot ((Snapshot) 0x0) /* same as NULL */
+#define SnapshotNow ((Snapshot) 0x1)
+#define SnapshotSelf ((Snapshot) 0x2)
+#define SnapshotAny ((Snapshot) 0x3)
+#define SnapshotToast ((Snapshot) 0x4)
extern DLLIMPORT Snapshot SnapshotDirty;
extern DLLIMPORT Snapshot QuerySnapshot;