Age Owner TLA Line data Source code
1 : /*--------------------------------------------------------------------------
2 : * gin_tuple.h
3 : * Public header file for Generalized Inverted Index access method.
4 : *
5 : * Copyright (c) 2006-2026, PostgreSQL Global Development Group
6 : *
7 : * src/include/access/gin_tuple.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 : Size 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 :
32 : /*
33 : * The key value is accessed in place, so it must be aligned well enough
34 : * for any key type.
35 : */
36 : char alignas(MAXIMUM_ALIGNOF) data[FLEXIBLE_ARRAY_MEMBER];
37 : } GinTuple;
38 :
39 : static inline ItemPointer
566 tomas.vondra@postgre 40 CBC 113297 : GinTupleGetFirst(GinTuple *tup)
41 : {
42 : GinPostingList *list;
43 :
44 113297 : list = (GinPostingList *) SHORTALIGN(tup->data + tup->keylen);
45 :
46 113297 : return &list->first;
47 : }
48 :
49 : extern int _gin_compare_tuples(GinTuple *a, GinTuple *b, SortSupport ssup);
50 :
51 : #endif /* GIN_TUPLE_H */
|