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-2018, 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_WITHOUT_OIDS 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; /* column numbers of indexed cols, or 0 */
48 
49 #ifdef CATALOG_VARLEN
50  oidvector indcollation; /* collation identifiers */
51  oidvector indclass; /* opclass identifiers */
52  int2vector indoption; /* per-column flags (AM-specific meanings) */
53  pg_node_tree indexprs; /* expression trees for index attributes that
54  * are not simple column references; one for
55  * each zero entry in indkey[] */
56  pg_node_tree indpred; /* expression tree for predicate, if a partial
57  * index; else NULL */
58 #endif
60 
61 /* ----------------
62  * Form_pg_index corresponds to a pointer to a tuple with
63  * the format of pg_index relation.
64  * ----------------
65  */
67 
68 #ifdef EXPOSE_TO_CLIENT_CODE
69 
70 /*
71  * Index AMs that support ordered scans must support these two indoption
72  * bits. Otherwise, the content of the per-column indoption fields is
73  * open for future definition.
74  */
75 #define INDOPTION_DESC 0x0001 /* values are in reverse order */
76 #define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */
77 
78 #endif /* EXPOSE_TO_CLIENT_CODE */
79 
80 /*
81  * Use of these macros is recommended over direct examination of the state
82  * flag columns where possible; this allows source code compatibility with
83  * the hacky representation used in 9.2.
84  */
85 #define IndexIsValid(indexForm) ((indexForm)->indisvalid)
86 #define IndexIsReady(indexForm) ((indexForm)->indisready)
87 #define IndexIsLive(indexForm) ((indexForm)->indislive)
88 
89 #endif /* PG_INDEX_H */
#define BKI_SCHEMA_MACRO
Definition: genbki.h:30
FormData_pg_index
Definition: pg_index.h:59
signed short int16
Definition: c.h:312
Definition: c.h:555
unsigned int Oid
Definition: postgres_ext.h:31
#define BKI_WITHOUT_OIDS
Definition: genbki.h:28
FormData_pg_index * Form_pg_index
Definition: pg_index.h:66
Definition: c.h:544
CATALOG(pg_index, 2610, IndexRelationId) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
Definition: pg_index.h:29