1 /*-------------------------------------------------------------------------
4 * definition of the system "index" relation (pg_index)
5 * along with the relation's initial contents.
8 * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/include/catalog/pg_index.h
14 * the genbki.pl script reads this file and generates .bki
15 * information from the DATA() statements.
17 *-------------------------------------------------------------------------
22 #include "catalog/genbki.h"
25 * pg_index definition. cpp turns this into
26 * typedef struct FormData_pg_index.
29 #define IndexRelationId 2610
31 CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
33 Oid indexrelid; /* OID of the index */
34 Oid indrelid; /* OID of the relation it indexes */
35 int16 indnatts; /* number of columns in index */
36 bool indisunique; /* is this a unique index? */
37 bool indisprimary; /* is this index for primary key? */
38 bool indisexclusion; /* is this index for exclusion constraint? */
39 bool indimmediate; /* is uniqueness enforced immediately? */
40 bool indisclustered; /* is this the index last clustered by? */
41 bool indisvalid; /* is this index valid for use by queries? */
42 bool indcheckxmin; /* must we wait for xmin to be old? */
43 bool indisready; /* is this index ready for inserts? */
44 bool indislive; /* is this index alive at all? */
45 bool indisreplident; /* is this index the identity for replication? */
47 /* variable-length fields start here, but we allow direct access to indkey */
48 int2vector indkey; /* column numbers of indexed cols, or 0 */
51 oidvector indcollation; /* collation identifiers */
52 oidvector indclass; /* opclass identifiers */
53 int2vector indoption; /* per-column flags (AM-specific meanings) */
54 pg_node_tree indexprs; /* expression trees for index attributes that
55 * are not simple column references; one for
56 * each zero entry in indkey[] */
57 pg_node_tree indpred; /* expression tree for predicate, if a partial
63 * Form_pg_index corresponds to a pointer to a tuple with
64 * the format of pg_index relation.
67 typedef FormData_pg_index *Form_pg_index;
70 * compiler constants for pg_index
73 #define Natts_pg_index 19
74 #define Anum_pg_index_indexrelid 1
75 #define Anum_pg_index_indrelid 2
76 #define Anum_pg_index_indnatts 3
77 #define Anum_pg_index_indisunique 4
78 #define Anum_pg_index_indisprimary 5
79 #define Anum_pg_index_indisexclusion 6
80 #define Anum_pg_index_indimmediate 7
81 #define Anum_pg_index_indisclustered 8
82 #define Anum_pg_index_indisvalid 9
83 #define Anum_pg_index_indcheckxmin 10
84 #define Anum_pg_index_indisready 11
85 #define Anum_pg_index_indislive 12
86 #define Anum_pg_index_indisreplident 13
87 #define Anum_pg_index_indkey 14
88 #define Anum_pg_index_indcollation 15
89 #define Anum_pg_index_indclass 16
90 #define Anum_pg_index_indoption 17
91 #define Anum_pg_index_indexprs 18
92 #define Anum_pg_index_indpred 19
95 * Index AMs that support ordered scans must support these two indoption
96 * bits. Otherwise, the content of the per-column indoption fields is
97 * open for future definition.
99 #define INDOPTION_DESC 0x0001 /* values are in reverse order */
100 #define INDOPTION_NULLS_FIRST 0x0002 /* NULLs are first instead of last */
103 * Use of these macros is recommended over direct examination of the state
104 * flag columns where possible; this allows source code compatibility with
105 * the hacky representation used in 9.2.
107 #define IndexIsValid(indexForm) ((indexForm)->indisvalid)
108 #define IndexIsReady(indexForm) ((indexForm)->indisready)
109 #define IndexIsLive(indexForm) ((indexForm)->indislive)
111 #endif /* PG_INDEX_H */