PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_index.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_index.h
4 * definition of the "index" system catalog (pg_index)
5 *
6 *
7 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/catalog/pg_index.h
11 *
12 * NOTES
13 * The Catalog.pm module reads this file and derives schema
14 * information.
15 *
16 *-------------------------------------------------------------------------
17 */
18#ifndef PG_INDEX_H
19#define PG_INDEX_H
20
21#include "catalog/genbki.h"
22#include "catalog/pg_index_d.h" /* IWYU pragma: export */
23
24/* ----------------
25 * pg_index definition. cpp turns this into
26 * typedef struct FormData_pg_index.
27 * ----------------
28 */
30
32{
33 Oid indexrelid BKI_LOOKUP(pg_class); /* OID of the index */
34 Oid indrelid BKI_LOOKUP(pg_class); /* OID of the relation it
35 * indexes */
36 int16 indnatts; /* total number of columns in index */
37 int16 indnkeyatts; /* number of key columns in index */
38 bool indisunique; /* is this a unique index? */
39 bool indnullsnotdistinct; /* null treatment in unique index */
40 bool indisprimary; /* is this index for primary key? */
41 bool indisexclusion; /* is this index for exclusion constraint? */
42 bool indimmediate; /* is uniqueness enforced immediately? */
43 bool indisclustered; /* is this the index last clustered by? */
44 bool indisvalid; /* is this index valid for use by queries? */
45 bool indcheckxmin; /* must we wait for xmin to be old? */
46 bool indisready; /* is this index ready for inserts? */
47 bool indislive; /* is this index alive at all? */
48 bool indisreplident; /* is this index the identity for replication? */
49
50 /* variable-length fields start here, but we allow direct access to indkey */
51 int2vector indkey BKI_FORCE_NOT_NULL; /* column numbers of indexed cols,
52 * or 0 */
53
54#ifdef CATALOG_VARLEN
57 int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags
58 * (AM-specific meanings) */
59 pg_node_tree indexprs; /* expression trees for index attributes that
60 * are not simple column references; one for
61 * each zero entry in indkey[] */
62 pg_node_tree indpred; /* expression tree for predicate, if a partial
63 * index; else NULL */
64#endif
66
68
69/* ----------------
70 * Form_pg_index corresponds to a pointer to a tuple with
71 * the format of pg_index relation.
72 * ----------------
73 */
75
77
80
82
83/* indkey can contain zero (InvalidAttrNumber) to represent expressions */
85
86#ifdef EXPOSE_TO_CLIENT_CODE
87
88/*
89 * Index AMs that support ordered scans must support these two indoption
90 * bits. Otherwise, the content of the per-column indoption fields is
91 * open for future definition.
92 */
93#define INDOPTION_DESC 0x0001 /* values are in reverse order */
94#define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */
95
96#endif /* EXPOSE_TO_CLIENT_CODE */
97
98#endif /* PG_INDEX_H */
int16_t int16
Definition c.h:553
#define BEGIN_CATALOG_STRUCT
Definition genbki.h:37
#define DECLARE_UNIQUE_INDEX_PKEY(name, oid, oidmacro, tblname, decl)
Definition genbki.h:105
#define BKI_LOOKUP(catalog)
Definition genbki.h:65
#define END_CATALOG_STRUCT
Definition genbki.h:38
#define BKI_LOOKUP_OPT(catalog)
Definition genbki.h:66
#define DECLARE_TOAST_WITH_MACRO(name, toastoid, indexoid, toastoidmacro, indexoidmacro)
Definition genbki.h:83
#define BKI_FORCE_NOT_NULL
Definition genbki.h:52
#define CATALOG(name, oid, oidmacro)
Definition genbki.h:42
#define DECLARE_ARRAY_FOREIGN_KEY_OPT(cols, reftbl, refcols)
Definition genbki.h:140
#define DECLARE_INDEX(name, oid, oidmacro, tblname, decl)
Definition genbki.h:103
#define MAKE_SYSCACHE(name, idxname, nbuckets)
Definition genbki.h:146
#define BKI_SCHEMA_MACRO
Definition genbki.h:48
int16 attnum
FormData_pg_index
Definition pg_index.h:65
END_CATALOG_STRUCT typedef FormData_pg_index * Form_pg_index
Definition pg_index.h:74
unsigned int Oid
static int fb(int x)
Definition c.h:757