1 /*--------------------------------------------------------------------------
3 * Public header file for Generalized Inverted Index access method.
5 * Copyright (c) 2006-2021, PostgreSQL Global Development Group
7 * src/include/access/gin.h
8 *--------------------------------------------------------------------------
13 #include "access/xlogreader.h"
14 #include "lib/stringinfo.h"
15 #include "storage/block.h"
16 #include "utils/relcache.h"
20 * amproc indexes for inverted indexes.
22 #define GIN_COMPARE_PROC 1
23 #define GIN_EXTRACTVALUE_PROC 2
24 #define GIN_EXTRACTQUERY_PROC 3
25 #define GIN_CONSISTENT_PROC 4
26 #define GIN_COMPARE_PARTIAL_PROC 5
27 #define GIN_TRICONSISTENT_PROC 6
28 #define GIN_OPTIONS_PROC 7
32 * searchMode settings for extractQueryFn.
34 #define GIN_SEARCH_MODE_DEFAULT 0
35 #define GIN_SEARCH_MODE_INCLUDE_EMPTY 1
36 #define GIN_SEARCH_MODE_ALL 2
37 #define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */
40 * GinStatsData represents stats data for planner use
42 typedef struct GinStatsData
44 BlockNumber nPendingPages
;
45 BlockNumber nTotalPages
;
46 BlockNumber nEntryPages
;
47 BlockNumber nDataPages
;
53 * A ternary value used by tri-consistent functions.
55 * This must be of the same size as a bool because some code will cast a
56 * pointer to a bool to a pointer to a GinTernaryValue.
58 typedef char GinTernaryValue
;
60 #define GIN_FALSE 0 /* item is not present / does not match */
61 #define GIN_TRUE 1 /* item is present / matches */
62 #define GIN_MAYBE 2 /* don't know if item is present / don't know
65 #define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
66 #define GinTernaryValueGetDatum(X) ((Datum)(X))
67 #define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
70 extern PGDLLIMPORT
int GinFuzzySearchLimit
;
71 extern int gin_pending_list_limit
;
74 extern void ginGetStats(Relation index
, GinStatsData
*stats
);
75 extern void ginUpdateStats(Relation index
, const GinStatsData
*stats
,