3 * internal declarations for BRIN indexes
5 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
6 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/brin_internal.h
11#ifndef BRIN_INTERNAL_H
12#define BRIN_INTERNAL_H
20 * A BrinDesc is a struct designed to enable decoding a BRIN tuple from the
21 * on-disk format to an in-memory tuple and vice-versa.
24/* struct returned by "OpcInfo" amproc */
27 /* Number of columns stored in an index column of this opclass */
30 /* Regular processing of NULLs in BrinValues? */
33 /* Opaque pointer for the opclass' private use */
36 /* Type cache entries of the stored columns */
40/* the size of a BrinOpcInfo for the given number of columns */
41 #define SizeofBrinOpcInfo(ncols) \
42 (offsetof(BrinOpcInfo, oi_typcache) + sizeof(TypeCacheEntry *) * ncols)
46 /* Containing memory context */
49 /* the index relation itself */
52 /* tuple descriptor of the index relation */
55 /* cached copy for on-disk tuples; generated at first use */
58 /* total number of Datum entries that are stored on-disk for all columns */
61 /* per-column info; bd_tupdesc->natts entries long */
66 * Globally-known function support numbers for BRIN indexes. Individual
67 * opclasses can define more function support numbers, which must fall into
68 * BRIN_FIRST_OPTIONAL_PROCNUM .. BRIN_LAST_OPTIONAL_PROCNUM.
70 #define BRIN_PROCNUM_OPCINFO 1
71 #define BRIN_PROCNUM_ADDVALUE 2
72 #define BRIN_PROCNUM_CONSISTENT 3
73 #define BRIN_PROCNUM_UNION 4
74 #define BRIN_MANDATORY_NPROCS 4
75 #define BRIN_PROCNUM_OPTIONS 5 /* optional */
76/* procedure numbers up to 10 are reserved for BRIN future expansion */
77 #define BRIN_FIRST_OPTIONAL_PROCNUM 11
78 #define BRIN_LAST_OPTIONAL_PROCNUM 15
83#define BRIN_elog(args) elog args
85 #define BRIN_elog(args) ((void) 0)
103 ScanKey orderbys,
int norderbys);
108 void *callback_state);
116#endif /* BRIN_INTERNAL_H */
static bool validate(Port *port, const char *auth)
static Datum values[MAXATTR]
void brininsertcleanup(Relation index, IndexInfo *indexInfo)
void brinrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, ScanKey orderbys, int norderbys)
bool brinvalidate(Oid opclassoid)
IndexBulkDeleteResult * brinbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
IndexScanDesc brinbeginscan(Relation r, int nkeys, int norderbys)
bytea * brinoptions(Datum reloptions, bool validate)
int64 bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
void brinbuildempty(Relation index)
void brin_free_desc(BrinDesc *bdesc)
struct BrinOpcInfo BrinOpcInfo
IndexBuildResult * brinbuild(Relation heap, Relation index, IndexInfo *indexInfo)
IndexBulkDeleteResult * brinvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
bool brininsert(Relation idxRel, Datum *values, bool *nulls, ItemPointer heaptid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, IndexInfo *indexInfo)
BrinDesc * brin_build_desc(Relation rel)
void brinendscan(IndexScanDesc scan)
#define FLEXIBLE_ARRAY_MEMBER
bool(* IndexBulkDeleteCallback)(ItemPointer itemptr, void *state)
BrinOpcInfo * bd_info[FLEXIBLE_ARRAY_MEMBER]
TypeCacheEntry * oi_typcache[FLEXIBLE_ARRAY_MEMBER]
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)