LCOV - code coverage report
Current view: top level - src/include/access - valid.h (source / functions) Coverage Total Hit
Test: Code coverage Lines: 90.0 % 20 18
Test Date: 2026-01-26 10:56:24 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 80.0 % 10 8

             Branch data     Line data    Source code
       1                 :             : /*-------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * valid.h
       4                 :             :  *        POSTGRES tuple qualification validity definitions.
       5                 :             :  *
       6                 :             :  *
       7                 :             :  * Portions Copyright (c) 1996-2026, 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                 :     1906735 : HeapKeyTest(HeapTuple tuple, TupleDesc tupdesc, int nkeys, ScanKey keys)
      29                 :             : {
      30                 :     1906735 :         int                     cur_nkeys = nkeys;
      31                 :     1906735 :         ScanKey         cur_key = keys;
      32                 :             : 
      33         [ +  + ]:     1923993 :         for (; cur_nkeys--; cur_key++)
      34                 :             :         {
      35                 :     1911430 :                 Datum           atp;
      36                 :     1911430 :                 bool            isnull;
      37                 :     1911430 :                 Datum           test;
      38                 :             : 
      39         [ -  + ]:     1911430 :                 if (cur_key->sk_flags & SK_ISNULL)
      40                 :           0 :                         return false;
      41                 :             : 
      42                 :     1911430 :                 atp = heap_getattr(tuple, cur_key->sk_attno, tupdesc, &isnull);
      43                 :             : 
      44         [ -  + ]:     1911430 :                 if (isnull)
      45                 :           0 :                         return false;
      46                 :             : 
      47                 :     3822860 :                 test = FunctionCall2Coll(&cur_key->sk_func,
      48                 :     1911430 :                                                                  cur_key->sk_collation,
      49                 :     1911430 :                                                                  atp, cur_key->sk_argument);
      50                 :             : 
      51         [ +  + ]:     1911430 :                 if (!DatumGetBool(test))
      52                 :     1894172 :                         return false;
      53         [ +  + ]:     1911430 :         }
      54                 :             : 
      55                 :       12563 :         return true;
      56                 :     1906735 : }
      57                 :             : 
      58                 :             : #endif                                                  /* VALID_H */
        

Generated by: LCOV version 2.3.2-1