summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorBruce Momjian1998-04-24 14:43:33 +0000
committerBruce Momjian1998-04-24 14:43:33 +0000
commit4cbfeef91291f4a4f38aa7ee7ee9030b94457fe1 (patch)
tree835c5c06b18e44d674b55ce9355bf057f57f4d50 /src/include/utils
parent7500a961f169455b95a97b59bf8a3544ec851fd0 (diff)
Inline some small functions called for every row.
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/tqual.h49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h
index 6ee27af2c27..ab14efb52e2 100644
--- a/src/include/utils/tqual.h
+++ b/src/include/utils/tqual.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tqual.h,v 1.11 1997/11/20 23:24:03 momjian Exp $
+ * $Id: tqual.h,v 1.12 1998/04/24 14:43:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,12 +15,51 @@
#include <access/htup.h>
-/* As above, plus updates in this command */
+extern TransactionId HeapSpecialTransactionId;
+extern CommandId HeapSpecialCommandId;
-extern void setheapoverride(bool on);
-extern bool heapisoverride(void);
+/*
+ * HeapTupleSatisfiesVisibility --
+ * True iff heap tuple satsifies a time qual.
+ *
+ * Note:
+ * Assumes heap tuple is valid.
+ */
+#define HeapTupleSatisfiesVisibility(tuple, seeself) \
+( \
+ TransactionIdEquals((tuple)->t_xmax, AmiTransactionId) ? \
+ false \
+ : \
+ ( \
+ ((seeself) == true || heapisoverride()) ? \
+ HeapTupleSatisfiesItself(tuple) \
+ : \
+ HeapTupleSatisfiesNow(tuple) \
+ ) \
+)
-extern bool HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself);
+#define heapisoverride() \
+( \
+ (!TransactionIdIsValid(HeapSpecialTransactionId)) ? \
+ false \
+ : \
+ ( \
+ (!TransactionIdEquals(GetCurrentTransactionId(), \
+ HeapSpecialTransactionId) || \
+ GetCurrentCommandId() != HeapSpecialCommandId) ? \
+ ( \
+ HeapSpecialTransactionId = InvalidTransactionId, \
+ false \
+ ) \
+ : \
+ true \
+ ) \
+)
+
+extern bool HeapTupleSatisfiesItself(HeapTuple tuple);
+extern bool HeapTupleSatisfiesNow(HeapTuple tuple);
+
+extern void setheapoverride(bool on);
#endif /* TQUAL_H */