PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pg_constraint.h File Reference
#include "catalog/genbki.h"
Include dependency graph for pg_constraint.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ConstraintRelationId   2606
 
#define Natts_pg_constraint   24
 
#define Anum_pg_constraint_conname   1
 
#define Anum_pg_constraint_connamespace   2
 
#define Anum_pg_constraint_contype   3
 
#define Anum_pg_constraint_condeferrable   4
 
#define Anum_pg_constraint_condeferred   5
 
#define Anum_pg_constraint_convalidated   6
 
#define Anum_pg_constraint_conrelid   7
 
#define Anum_pg_constraint_contypid   8
 
#define Anum_pg_constraint_conindid   9
 
#define Anum_pg_constraint_confrelid   10
 
#define Anum_pg_constraint_confupdtype   11
 
#define Anum_pg_constraint_confdeltype   12
 
#define Anum_pg_constraint_confmatchtype   13
 
#define Anum_pg_constraint_conislocal   14
 
#define Anum_pg_constraint_coninhcount   15
 
#define Anum_pg_constraint_connoinherit   16
 
#define Anum_pg_constraint_conkey   17
 
#define Anum_pg_constraint_confkey   18
 
#define Anum_pg_constraint_conpfeqop   19
 
#define Anum_pg_constraint_conppeqop   20
 
#define Anum_pg_constraint_conffeqop   21
 
#define Anum_pg_constraint_conexclop   22
 
#define Anum_pg_constraint_conbin   23
 
#define Anum_pg_constraint_consrc   24
 
#define CONSTRAINT_CHECK   'c'
 
#define CONSTRAINT_FOREIGN   'f'
 
#define CONSTRAINT_PRIMARY   'p'
 
#define CONSTRAINT_UNIQUE   'u'
 
#define CONSTRAINT_TRIGGER   't'
 
#define CONSTRAINT_EXCLUSION   'x'
 

Typedefs

typedef FormData_pg_constraintForm_pg_constraint
 

Functions

 CATALOG (pg_constraint, 2606)
 

Variables

 FormData_pg_constraint
 

Macro Definition Documentation

#define Anum_pg_constraint_condeferrable   4

Definition at line 157 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_condeferred   5

Definition at line 158 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conexclop   22
#define Anum_pg_constraint_confdeltype   12

Definition at line 165 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conffeqop   21

Definition at line 174 of file pg_constraint.h.

Referenced by CreateConstraintEntry(), and ri_LoadConstraintInfo().

#define Anum_pg_constraint_confkey   18
#define Anum_pg_constraint_confmatchtype   13

Definition at line 166 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_confrelid   10

Definition at line 163 of file pg_constraint.h.

Referenced by ATPrepChangePersistence(), and CreateConstraintEntry().

#define Anum_pg_constraint_confupdtype   11

Definition at line 164 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conindid   9

Definition at line 162 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_coninhcount   15

Definition at line 168 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conislocal   14

Definition at line 167 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conkey   17
#define Anum_pg_constraint_conname   1
#define Anum_pg_constraint_connamespace   2
#define Anum_pg_constraint_connoinherit   16

Definition at line 169 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_conpfeqop   19
#define Anum_pg_constraint_conppeqop   20

Definition at line 173 of file pg_constraint.h.

Referenced by CreateConstraintEntry(), and ri_LoadConstraintInfo().

#define Anum_pg_constraint_consrc   24

Definition at line 177 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_contype   3

Definition at line 156 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define Anum_pg_constraint_convalidated   6

Definition at line 159 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

#define CONSTRAINT_TRIGGER   't'

Definition at line 192 of file pg_constraint.h.

Referenced by CreateTrigger(), and pg_get_constraintdef_worker().

#define CONSTRAINT_UNIQUE   'u'
#define Natts_pg_constraint   24

Definition at line 153 of file pg_constraint.h.

Referenced by CreateConstraintEntry().

Typedef Documentation

Function Documentation

CATALOG ( pg_constraint  ,
2606   
)

Definition at line 31 of file pg_constraint.h.

32 {
33  /*
34  * conname + connamespace is deliberately not unique; we allow, for
35  * example, the same name to be used for constraints of different
36  * relations. This is partly for backwards compatibility with past
37  * Postgres practice, and partly because we don't want to have to obtain a
38  * global lock to generate a globally unique name for a nameless
39  * constraint. We associate a namespace with constraint names only for
40  * SQL-spec compatibility.
41  */
42  NameData conname; /* name of this constraint */
43  Oid connamespace; /* OID of namespace containing constraint */
44  char contype; /* constraint type; see codes below */
45  bool condeferrable; /* deferrable constraint? */
46  bool condeferred; /* deferred by default? */
47  bool convalidated; /* constraint has been validated? */
48 
49  /*
50  * conrelid and conkey are only meaningful if the constraint applies to a
51  * specific relation (this excludes domain constraints and assertions).
52  * Otherwise conrelid is 0 and conkey is NULL.
53  */
54  Oid conrelid; /* relation this constraint constrains */
55 
56  /*
57  * contypid links to the pg_type row for a domain if this is a domain
58  * constraint. Otherwise it's 0.
59  *
60  * For SQL-style global ASSERTIONs, both conrelid and contypid would be
61  * zero. This is not presently supported, however.
62  */
63  Oid contypid; /* domain this constraint constrains */
64 
65  /*
66  * conindid links to the index supporting the constraint, if any;
67  * otherwise it's 0. This is used for unique, primary-key, and exclusion
68  * constraints, and less obviously for foreign-key constraints (where the
69  * index is a unique index on the referenced relation's referenced
70  * columns). Notice that the index is on conrelid in the first case but
71  * confrelid in the second.
72  */
73  Oid conindid; /* index supporting this constraint */
74 
75  /*
76  * These fields, plus confkey, are only meaningful for a foreign-key
77  * constraint. Otherwise confrelid is 0 and the char fields are spaces.
78  */
79  Oid confrelid; /* relation referenced by foreign key */
80  char confupdtype; /* foreign key's ON UPDATE action */
81  char confdeltype; /* foreign key's ON DELETE action */
82  char confmatchtype; /* foreign key's match type */
83 
84  /* Has a local definition (hence, do not drop when coninhcount is 0) */
85  bool conislocal;
86 
87  /* Number of times inherited from direct parent relation(s) */
88  int32 coninhcount;
89 
90  /* Has a local definition and cannot be inherited */
91  bool connoinherit;
92 
93 #ifdef CATALOG_VARLEN /* variable-length fields start here */
94 
95  /*
96  * Columns of conrelid that the constraint applies to, if known (this is
97  * NULL for trigger constraints)
98  */
99  int16 conkey[1];
100 
101  /*
102  * If a foreign key, the referenced columns of confrelid
103  */
104  int16 confkey[1];
105 
106  /*
107  * If a foreign key, the OIDs of the PK = FK equality operators for each
108  * column of the constraint
109  */
110  Oid conpfeqop[1];
111 
112  /*
113  * If a foreign key, the OIDs of the PK = PK equality operators for each
114  * column of the constraint (i.e., equality for the referenced columns)
115  */
116  Oid conppeqop[1];
117 
118  /*
119  * If a foreign key, the OIDs of the FK = FK equality operators for each
120  * column of the constraint (i.e., equality for the referencing columns)
121  */
122  Oid conffeqop[1];
123 
124  /*
125  * If an exclusion constraint, the OIDs of the exclusion operators for
126  * each column of the constraint
127  */
128  Oid conexclop[1];
129 
130  /*
131  * If a check constraint, nodeToString representation of expression
132  */
133  pg_node_tree conbin;
134 
135  /*
136  * If a check constraint, source-text representation of expression
137  */
138  text consrc;
139 #endif
signed short int16
Definition: c.h:252
FormData_pg_constraint
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:253
Definition: c.h:488
Definition: c.h:434

Variable Documentation

FormData_pg_constraint

Definition at line 140 of file pg_constraint.h.