1
/*-------------------------------------------------------------------------
4
* POSTGRES tuple qualification validity definitions.
7
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
10
* $PostgreSQL: pgsql/src/include/access/valid.h,v 1.36 2004-12-31 22:03:21 pgsql Exp $
12
*-------------------------------------------------------------------------
20
* Test a heap tuple to see if it satisfies a scan key.
22
#define HeapKeyTest(tuple, \
29
/* Use underscores to protect the variables passed in as parameters */ \
30
int __cur_nkeys = (nkeys); \
31
ScanKey __cur_keys = (keys); \
33
(result) = true; /* may change */ \
34
for (; __cur_nkeys--; __cur_keys++) \
40
if (__cur_keys->sk_flags & SK_ISNULL) \
46
__atp = heap_getattr((tuple), \
47
__cur_keys->sk_attno, \
57
__test = FunctionCall2(&__cur_keys->sk_func, \
58
__atp, __cur_keys->sk_argument); \
60
if (!DatumGetBool(__test)) \
71
* res is set TRUE if the HeapTuple satisfies the timequal and keytest,
72
* otherwise it is set FALSE. Note that the hint bits in the HeapTuple's
73
* t_infomask may be updated as a side effect.
75
* on 8/21/92 mao says: i rearranged the tests here to do keytest before
76
* SatisfiesTimeQual. profiling indicated that even for vacuumed relations,
77
* time qual checking was more expensive than key testing. time qual is
78
* least likely to fail, too. we should really add the time qual test to
79
* the restriction and optimize it in the normal way. this has interactions
80
* with joey's expensive function work.
82
#define HeapTupleSatisfies(tuple, \
93
HeapKeyTest(tuple, RelationGetDescr(relation), nKeys, key, res); \
97
if ((res) && (relation)->rd_rel->relkind != RELKIND_UNCATALOGED) \
98
(res) = HeapTupleSatisfiesVisibility(tuple, snapshot, buffer); \