PostgreSQL Source Code
git master
valid.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* valid.h
4
* POSTGRES tuple qualification validity definitions.
5
*
6
*
7
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
9
*
10
* src/include/access/valid.h
11
*
12
*-------------------------------------------------------------------------
13
*/
14
#ifndef VALID_H
15
#define VALID_H
16
17
#include "
access/htup.h
"
18
#include "
access/htup_details.h
"
19
#include "
access/skey.h
"
20
#include "
access/tupdesc.h
"
21
22
/*
23
* HeapKeyTest
24
*
25
* Test a heap tuple to see if it satisfies a scan key.
26
*/
27
static
inline
bool
28
HeapKeyTest
(
HeapTuple
tuple,
TupleDesc
tupdesc,
int
nkeys,
ScanKey
keys)
29
{
30
int
cur_nkeys = nkeys;
31
ScanKey
cur_key = keys;
32
33
for
(; cur_nkeys--; cur_key++)
34
{
35
Datum
atp;
36
bool
isnull;
37
Datum
test
;
38
39
if
(cur_key->
sk_flags
&
SK_ISNULL
)
40
return
false
;
41
42
atp =
heap_getattr
(tuple, cur_key->
sk_attno
, tupdesc, &isnull);
43
44
if
(isnull)
45
return
false
;
46
47
test
=
FunctionCall2Coll
(&cur_key->
sk_func
,
48
cur_key->
sk_collation
,
49
atp, cur_key->
sk_argument
);
50
51
if
(!
DatumGetBool
(
test
))
52
return
false
;
53
}
54
55
return
true
;
56
}
57
58
#endif
/* VALID_H */
FunctionCall2Coll
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition:
fmgr.c:1149
htup.h
htup_details.h
heap_getattr
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Definition:
htup_details.h:792
DatumGetBool
static bool DatumGetBool(Datum X)
Definition:
postgres.h:90
Datum
uintptr_t Datum
Definition:
postgres.h:64
test
static void test(void)
Definition:
preproc-autoprep.c:26
skey.h
SK_ISNULL
#define SK_ISNULL
Definition:
skey.h:115
HeapTupleData
Definition:
htup.h:63
ScanKeyData
Definition:
skey.h:65
ScanKeyData::sk_flags
int sk_flags
Definition:
skey.h:66
ScanKeyData::sk_argument
Datum sk_argument
Definition:
skey.h:72
ScanKeyData::sk_func
FmgrInfo sk_func
Definition:
skey.h:71
ScanKeyData::sk_collation
Oid sk_collation
Definition:
skey.h:70
ScanKeyData::sk_attno
AttrNumber sk_attno
Definition:
skey.h:67
TupleDescData
Definition:
tupdesc.h:80
tupdesc.h
HeapKeyTest
static bool HeapKeyTest(HeapTuple tuple, TupleDesc tupdesc, int nkeys, ScanKey keys)
Definition:
valid.h:28
src
include
access
valid.h
Generated on Sun Sep 15 2024 12:13:23 for PostgreSQL Source Code by
1.9.1