PostgreSQL Source Code  git master
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-2020, 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"
23 
24 /* ----------------
25  * pg_index definition. cpp turns this into
26  * typedef struct FormData_pg_index.
27  * ----------------
28  */
29 CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO
30 {
31  Oid indexrelid; /* OID of the index */
32  Oid indrelid; /* OID of the relation it indexes */
33  int16 indnatts; /* total number of columns in index */
34  int16 indnkeyatts; /* number of key columns in index */
35  bool indisunique; /* is this a unique index? */
36  bool indisprimary; /* is this index for primary key? */
37  bool indisexclusion; /* is this index for exclusion constraint? */
38  bool indimmediate; /* is uniqueness enforced immediately? */
39  bool indisclustered; /* is this the index last clustered by? */
40  bool indisvalid; /* is this index valid for use by queries? */
41  bool indcheckxmin; /* must we wait for xmin to be old? */
42  bool indisready; /* is this index ready for inserts? */
43  bool indislive; /* is this index alive at all? */
44  bool indisreplident; /* is this index the identity for replication? */
45 
46  /* variable-length fields start here, but we allow direct access to indkey */
47  int2vector indkey BKI_FORCE_NOT_NULL; /* column numbers of indexed cols,
48  * or 0 */
49 
50 #ifdef CATALOG_VARLEN
51  oidvector indcollation BKI_FORCE_NOT_NULL; /* collation identifiers */
52  oidvector indclass BKI_FORCE_NOT_NULL; /* opclass identifiers */
53  int2vector indoption BKI_FORCE_NOT_NULL; /* per-column flags
54  * (AM-specific meanings) */
55  pg_node_tree indexprs; /* expression trees for index attributes that
56  * are not simple column references; one for
57  * each zero entry in indkey[] */
58  pg_node_tree indpred; /* expression tree for predicate, if a partial
59  * index; else NULL */
60 #endif
62 
63 /* ----------------
64  * Form_pg_index corresponds to a pointer to a tuple with
65  * the format of pg_index relation.
66  * ----------------
67  */
69 
70 #ifdef EXPOSE_TO_CLIENT_CODE
71 
72 /*
73  * Index AMs that support ordered scans must support these two indoption
74  * bits. Otherwise, the content of the per-column indoption fields is
75  * open for future definition.
76  */
77 #define INDOPTION_DESC 0x0001 /* values are in reverse order */
78 #define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */
79 
80 #endif /* EXPOSE_TO_CLIENT_CODE */
81 
82 #endif /* PG_INDEX_H */
#define BKI_SCHEMA_MACRO
Definition: genbki.h:29
FormData_pg_index
Definition: pg_index.h:61
signed short int16
Definition: c.h:361
Definition: c.h:601
unsigned int Oid
Definition: postgres_ext.h:31
CATALOG(pg_index, 2610, IndexRelationId) BKI_SCHEMA_MACRO
Definition: pg_index.h:29
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:33
FormData_pg_index * Form_pg_index
Definition: pg_index.h:68
Definition: c.h:590