Fix pg_dump bug in the database-level collation patch. "datcollate" and
[PostgreSQL.git] / src / include / access / valid.h
blobe8f1eae65ff27d8d384331a3116d54c5b017a01f
1 /*-------------------------------------------------------------------------
3 * valid.h
4 * POSTGRES tuple qualification validity definitions.
7 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL$
12 *-------------------------------------------------------------------------
14 #ifndef VALID_H
15 #define VALID_H
18 * HeapKeyTest
20 * Test a heap tuple to see if it satisfies a scan key.
22 #define HeapKeyTest(tuple, \
23 tupdesc, \
24 nkeys, \
25 keys, \
26 result) \
27 do \
28 { \
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++) \
35 { \
36 Datum __atp; \
37 bool __isnull; \
38 Datum __test; \
40 if (__cur_keys->sk_flags & SK_ISNULL) \
41 { \
42 (result) = false; \
43 break; \
44 } \
46 __atp = heap_getattr((tuple), \
47 __cur_keys->sk_attno, \
48 (tupdesc), \
49 &__isnull); \
51 if (__isnull) \
52 { \
53 (result) = false; \
54 break; \
55 } \
57 __test = FunctionCall2(&__cur_keys->sk_func, \
58 __atp, __cur_keys->sk_argument); \
60 if (!DatumGetBool(__test)) \
61 { \
62 (result) = false; \
63 break; \
64 } \
65 } \
66 } while (0)
68 #endif /* VALID_H */