LCOV - differential code coverage report
Current view: top level - src/include/nodes - queryjumble.h (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 83.3 % 6 5 1 5
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 1 1 1
Baseline: 16@8cea358b128 Branches: 75.0 % 4 3 1 3
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 83.3 % 6 5 1 5
Function coverage date bins:
(240..) days: 100.0 % 1 1 1
Branch coverage date bins:
(240..) days: 75.0 % 4 3 1 3

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * queryjumble.h
                                  4                 :                :  *    Query normalization and fingerprinting.
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  * IDENTIFICATION
                                 10                 :                :  *    src/include/nodes/queryjumble.h
                                 11                 :                :  *
                                 12                 :                :  *-------------------------------------------------------------------------
                                 13                 :                :  */
                                 14                 :                : #ifndef QUERYJUMBLE_H
                                 15                 :                : #define QUERYJUMBLE_H
                                 16                 :                : 
                                 17                 :                : #include "nodes/parsenodes.h"
                                 18                 :                : 
                                 19                 :                : /*
                                 20                 :                :  * Struct for tracking locations/lengths of constants during normalization
                                 21                 :                :  */
                                 22                 :                : typedef struct LocationLen
                                 23                 :                : {
                                 24                 :                :     int         location;       /* start offset in query text */
                                 25                 :                :     int         length;         /* length in bytes, or -1 to ignore */
                                 26                 :                : } LocationLen;
                                 27                 :                : 
                                 28                 :                : /*
                                 29                 :                :  * Working state for computing a query jumble and producing a normalized
                                 30                 :                :  * query string
                                 31                 :                :  */
                                 32                 :                : typedef struct JumbleState
                                 33                 :                : {
                                 34                 :                :     /* Jumble of current query tree */
                                 35                 :                :     unsigned char *jumble;
                                 36                 :                : 
                                 37                 :                :     /* Number of bytes used in jumble[] */
                                 38                 :                :     Size        jumble_len;
                                 39                 :                : 
                                 40                 :                :     /* Array of locations of constants that should be removed */
                                 41                 :                :     LocationLen *clocations;
                                 42                 :                : 
                                 43                 :                :     /* Allocated length of clocations array */
                                 44                 :                :     int         clocations_buf_size;
                                 45                 :                : 
                                 46                 :                :     /* Current number of valid entries in clocations array */
                                 47                 :                :     int         clocations_count;
                                 48                 :                : 
                                 49                 :                :     /* highest Param id we've seen, in order to start normalization correctly */
                                 50                 :                :     int         highest_extern_param_id;
                                 51                 :                : } JumbleState;
                                 52                 :                : 
                                 53                 :                : /* Values for the compute_query_id GUC */
                                 54                 :                : enum ComputeQueryIdType
                                 55                 :                : {
                                 56                 :                :     COMPUTE_QUERY_ID_OFF,
                                 57                 :                :     COMPUTE_QUERY_ID_ON,
                                 58                 :                :     COMPUTE_QUERY_ID_AUTO,
                                 59                 :                :     COMPUTE_QUERY_ID_REGRESS,
                                 60                 :                : };
                                 61                 :                : 
                                 62                 :                : /* GUC parameters */
                                 63                 :                : extern PGDLLIMPORT int compute_query_id;
                                 64                 :                : 
                                 65                 :                : 
                                 66                 :                : extern const char *CleanQuerytext(const char *query, int *location, int *len);
                                 67                 :                : extern JumbleState *JumbleQuery(Query *query);
                                 68                 :                : extern void EnableQueryId(void);
                                 69                 :                : 
                                 70                 :                : extern PGDLLIMPORT bool query_id_enabled;
                                 71                 :                : 
                                 72                 :                : /*
                                 73                 :                :  * Returns whether query identifier computation has been enabled, either
                                 74                 :                :  * directly in the GUC or by a module when the setting is 'auto'.
                                 75                 :                :  */
                                 76                 :                : static inline bool
 1065 alvherre@alvh.no-ip.       77                 :CBC      445193 : IsQueryIdEnabled(void)
                                 78                 :                : {
                                 79         [ -  + ]:         445193 :     if (compute_query_id == COMPUTE_QUERY_ID_OFF)
 1065 alvherre@alvh.no-ip.       80                 :UBC           0 :         return false;
 1065 alvherre@alvh.no-ip.       81         [ +  + ]:CBC      445193 :     if (compute_query_id == COMPUTE_QUERY_ID_ON)
                                 82                 :             92 :         return true;
                                 83                 :         445101 :     return query_id_enabled;
                                 84                 :                : }
                                 85                 :                : 
                                 86                 :                : #endif                          /* QUERYJUMBLE_H */
        

Generated by: LCOV version 2.1-beta2-3-g6141622