Age Owner TLA Line data Source code
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_TUPLE_H
11 : #define GIN_TUPLE_H
12 :
13 : #include "access/ginblock.h"
14 : #include "storage/itemptr.h"
15 : #include "utils/sortsupport.h"
16 :
17 : /*
18 : * Data for one key in a GIN index. (This is not the permanent in-index
19 : * representation, but just a convenient format to use during the tuplesort
20 : * stage of building a new GIN index.)
21 : */
22 : typedef struct GinTuple
23 : {
24 : int tuplen; /* length of the whole tuple */
25 : OffsetNumber attrnum; /* attnum of index key */
26 : uint16 keylen; /* bytes in data for key value */
27 : int16 typlen; /* typlen for key */
28 : bool typbyval; /* typbyval for key */
29 : signed char category; /* category: normal or NULL? */
30 : int nitems; /* number of TIDs in the data */
31 : char data[FLEXIBLE_ARRAY_MEMBER];
32 : } GinTuple;
33 :
34 : static inline ItemPointer
187 tomas.vondra@postgre 35 UBC 0 : GinTupleGetFirst(GinTuple *tup)
36 : {
37 : GinPostingList *list;
38 :
39 0 : list = (GinPostingList *) SHORTALIGN(tup->data + tup->keylen);
40 :
41 0 : return &list->first;
42 : }
43 :
44 : extern int _gin_compare_tuples(GinTuple *a, GinTuple *b, SortSupport ssup);
45 :
46 : #endif /* GIN_TUPLE_H */
|