Coverage Report

Created: 2025-06-15 06:31

/src/postgres/src/include/access/gin.h
Line
Count
Source (jump to first uncovered line)
1
/*--------------------------------------------------------------------------
2
 * gin.h
3
 *    Public header file for Generalized Inverted Index access method.
4
 *
5
 *  Copyright (c) 2006-2025, PostgreSQL Global Development Group
6
 *
7
 *  src/include/access/gin.h
8
 *--------------------------------------------------------------------------
9
 */
10
#ifndef GIN_H
11
#define GIN_H
12
13
#include "access/xlogreader.h"
14
#include "lib/stringinfo.h"
15
#include "nodes/execnodes.h"
16
#include "storage/shm_toc.h"
17
#include "storage/block.h"
18
#include "utils/relcache.h"
19
20
21
/*
22
 * amproc indexes for inverted indexes.
23
 */
24
0
#define GIN_COMPARE_PROC         1
25
0
#define GIN_EXTRACTVALUE_PROC      2
26
0
#define GIN_EXTRACTQUERY_PROC      3
27
0
#define GIN_CONSISTENT_PROC        4
28
0
#define GIN_COMPARE_PARTIAL_PROC     5
29
0
#define GIN_TRICONSISTENT_PROC       6
30
0
#define GIN_OPTIONS_PROC     7
31
0
#define GINNProcs            7
32
33
/*
34
 * searchMode settings for extractQueryFn.
35
 */
36
0
#define GIN_SEARCH_MODE_DEFAULT     0
37
0
#define GIN_SEARCH_MODE_INCLUDE_EMPTY 1
38
0
#define GIN_SEARCH_MODE_ALL       2
39
0
#define GIN_SEARCH_MODE_EVERYTHING    3  /* for internal use only */
40
41
/*
42
 * Constant definition for progress reporting.  Phase numbers must match
43
 * ginbuildphasename.
44
 */
45
/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 (see progress.h) */
46
0
#define PROGRESS_GIN_PHASE_INDEXBUILD_TABLESCAN   2
47
0
#define PROGRESS_GIN_PHASE_PERFORMSORT_1      3
48
0
#define PROGRESS_GIN_PHASE_MERGE_1          4
49
0
#define PROGRESS_GIN_PHASE_PERFORMSORT_2      5
50
0
#define PROGRESS_GIN_PHASE_MERGE_2          6
51
52
/*
53
 * GinStatsData represents stats data for planner use
54
 */
55
typedef struct GinStatsData
56
{
57
  BlockNumber nPendingPages;
58
  BlockNumber nTotalPages;
59
  BlockNumber nEntryPages;
60
  BlockNumber nDataPages;
61
  int64   nEntries;
62
  int32   ginVersion;
63
} GinStatsData;
64
65
/*
66
 * A ternary value used by tri-consistent functions.
67
 *
68
 * This must be of the same size as a bool because some code will cast a
69
 * pointer to a bool to a pointer to a GinTernaryValue.
70
 */
71
typedef char GinTernaryValue;
72
73
StaticAssertDecl(sizeof(GinTernaryValue) == sizeof(bool),
74
         "sizes of GinTernaryValue and bool are not equal");
75
76
0
#define GIN_FALSE   0    /* item is not present / does not match */
77
0
#define GIN_TRUE    1    /* item is present / matches */
78
0
#define GIN_MAYBE   2    /* don't know if item is present / don't know
79
                 * if matches */
80
81
static inline GinTernaryValue
82
DatumGetGinTernaryValue(Datum X)
83
0
{
84
0
  return (GinTernaryValue) X;
85
0
}
Unexecuted instantiation: ginarrayproc.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginbtree.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginbulk.c:DatumGetGinTernaryValue
Unexecuted instantiation: gindatapage.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginentrypage.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginfast.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginget.c:DatumGetGinTernaryValue
Unexecuted instantiation: gininsert.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginlogic.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginpostinglist.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginscan.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginutil.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginvacuum.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginvalidate.c:DatumGetGinTernaryValue
Unexecuted instantiation: ginxlog.c:DatumGetGinTernaryValue
Unexecuted instantiation: parallel.c:DatumGetGinTernaryValue
Unexecuted instantiation: jsonb_gin.c:DatumGetGinTernaryValue
Unexecuted instantiation: selfuncs.c:DatumGetGinTernaryValue
Unexecuted instantiation: tsginidx.c:DatumGetGinTernaryValue
Unexecuted instantiation: guc_tables.c:DatumGetGinTernaryValue
86
87
static inline Datum
88
GinTernaryValueGetDatum(GinTernaryValue X)
89
0
{
90
0
  return (Datum) X;
91
0
}
Unexecuted instantiation: ginarrayproc.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginbtree.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginbulk.c:GinTernaryValueGetDatum
Unexecuted instantiation: gindatapage.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginentrypage.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginfast.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginget.c:GinTernaryValueGetDatum
Unexecuted instantiation: gininsert.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginlogic.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginpostinglist.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginscan.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginutil.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginvacuum.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginvalidate.c:GinTernaryValueGetDatum
Unexecuted instantiation: ginxlog.c:GinTernaryValueGetDatum
Unexecuted instantiation: parallel.c:GinTernaryValueGetDatum
Unexecuted instantiation: jsonb_gin.c:GinTernaryValueGetDatum
Unexecuted instantiation: selfuncs.c:GinTernaryValueGetDatum
Unexecuted instantiation: tsginidx.c:GinTernaryValueGetDatum
Unexecuted instantiation: guc_tables.c:GinTernaryValueGetDatum
92
93
0
#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
94
95
/* GUC parameters */
96
extern PGDLLIMPORT int GinFuzzySearchLimit;
97
extern PGDLLIMPORT int gin_pending_list_limit;
98
99
/* ginutil.c */
100
extern void ginGetStats(Relation index, GinStatsData *stats);
101
extern void ginUpdateStats(Relation index, const GinStatsData *stats,
102
               bool is_build);
103
104
extern void _gin_parallel_build_main(dsm_segment *seg, shm_toc *toc);
105
106
#endif              /* GIN_H */