OSDN Git Service

Inline some small functions called for every row.
[pg-rex/syncrep.git] / src / include / utils / tqual.h
1 /*-------------------------------------------------------------------------
2  *
3  * tqual.h--
4  *        POSTGRES "time" qualification definitions.
5  *
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: tqual.h,v 1.12 1998/04/24 14:43:33 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef TQUAL_H
14 #define TQUAL_H
15
16 #include <access/htup.h>
17
18 extern TransactionId HeapSpecialTransactionId;
19 extern CommandId HeapSpecialCommandId;
20
21 /*
22  * HeapTupleSatisfiesVisibility --
23  *              True iff heap tuple satsifies a time qual.
24  *
25  * Note:
26  *              Assumes heap tuple is valid.
27  */
28 #define HeapTupleSatisfiesVisibility(tuple, seeself) \
29 ( \
30         TransactionIdEquals((tuple)->t_xmax, AmiTransactionId) ? \
31                 false \
32         : \
33         ( \
34                 ((seeself) == true || heapisoverride()) ? \
35                         HeapTupleSatisfiesItself(tuple) \
36                 : \
37                         HeapTupleSatisfiesNow(tuple) \
38         ) \
39 )
40
41 #define heapisoverride() \
42 ( \
43         (!TransactionIdIsValid(HeapSpecialTransactionId)) ? \
44                 false \
45         : \
46         ( \
47                 (!TransactionIdEquals(GetCurrentTransactionId(), \
48                                                          HeapSpecialTransactionId) || \
49                  GetCurrentCommandId() != HeapSpecialCommandId) ? \
50                 ( \
51                         HeapSpecialTransactionId = InvalidTransactionId, \
52                         false \
53                 ) \
54                 : \
55                         true \
56         ) \
57 )
58
59 extern bool HeapTupleSatisfiesItself(HeapTuple tuple);
60 extern bool HeapTupleSatisfiesNow(HeapTuple tuple);
61
62 extern void setheapoverride(bool on);
63
64
65 #endif                                                  /* TQUAL_H */