PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
gin.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------
2  * gin.h
3  * Public header file for Generalized Inverted Index access method.
4  *
5  * Copyright (c) 2006-2017, 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 "storage/block.h"
16 #include "utils/relcache.h"
17 
18 
19 /*
20  * amproc indexes for inverted indexes.
21  */
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 GINNProcs 6
29 
30 /*
31  * searchMode settings for extractQueryFn.
32  */
33 #define GIN_SEARCH_MODE_DEFAULT 0
34 #define GIN_SEARCH_MODE_INCLUDE_EMPTY 1
35 #define GIN_SEARCH_MODE_ALL 2
36 #define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */
37 
38 /*
39  * GinStatsData represents stats data for planner use
40  */
41 typedef struct GinStatsData
42 {
47  int64 nEntries;
49 } GinStatsData;
50 
51 /*
52  * A ternary value used by tri-consistent functions.
53  *
54  * For convenience, this is compatible with booleans. A boolean can be
55  * safely cast to a GinTernaryValue.
56  */
57 typedef char GinTernaryValue;
58 
59 #define GIN_FALSE 0 /* item is not present / does not match */
60 #define GIN_TRUE 1 /* item is present / matches */
61 #define GIN_MAYBE 2 /* don't know if item is present / don't know
62  * if matches */
63 
64 #define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
65 #define GinTernaryValueGetDatum(X) ((Datum)(X))
66 #define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
67 
68 /* GUC parameters */
70 extern int gin_pending_list_limit;
71 
72 /* ginutil.c */
73 extern void ginGetStats(Relation index, GinStatsData *stats);
74 extern void ginUpdateStats(Relation index, const GinStatsData *stats);
75 
76 #endif /* GIN_H */
BlockNumber nEntryPages
Definition: gin.h:45
int64 nEntries
Definition: gin.h:47
void ginGetStats(Relation index, GinStatsData *stats)
Definition: ginutil.c:634
uint32 BlockNumber
Definition: block.h:31
#define PGDLLIMPORT
Definition: c.h:1064
signed int int32
Definition: c.h:256
Definition: type.h:89
char GinTernaryValue
Definition: gin.h:57
struct GinStatsData GinStatsData
void ginUpdateStats(Relation index, const GinStatsData *stats)
Definition: ginutil.c:661
BlockNumber nPendingPages
Definition: gin.h:43
BlockNumber nDataPages
Definition: gin.h:46
BlockNumber nTotalPages
Definition: gin.h:44
int32 ginVersion
Definition: gin.h:48
int gin_pending_list_limit
Definition: ginfast.c:37
PGDLLIMPORT int GinFuzzySearchLimit
Definition: ginget.c:24