1 /*-------------------------------------------------------------------------
4 * POSTGRES tuple qualification validity definitions.
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/access/valid.h
12 *-------------------------------------------------------------------------
17 #include "access/htup.h"
18 #include "access/htup_details.h"
19 #include "access/skey.h"
20 #include "access/tupdesc.h"
25 * Test a heap tuple to see if it satisfies a scan key.
28 HeapKeyTest(HeapTuple tuple
, TupleDesc tupdesc
, int nkeys
, ScanKey keys
)
30 int cur_nkeys
= nkeys
;
31 ScanKey cur_key
= keys
;
33 for (; cur_nkeys
--; cur_key
++)
39 if (cur_key
->sk_flags
& SK_ISNULL
)
42 atp
= heap_getattr(tuple
, cur_key
->sk_attno
, tupdesc
, &isnull
);
47 test
= FunctionCall2Coll(&cur_key
->sk_func
,
48 cur_key
->sk_collation
,
49 atp
, cur_key
->sk_argument
);
51 if (!DatumGetBool(test
))