PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pg_constraint_fn.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_constraint_fn.h
4  * prototypes for functions in catalog/pg_constraint.c
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/pg_constraint_fn.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PG_CONSTRAINT_FN_H
15 #define PG_CONSTRAINT_FN_H
16 
17 #include "catalog/dependency.h"
18 #include "nodes/pg_list.h"
19 
20 /*
21  * Identify constraint type for lookup purposes
22  */
23 typedef enum ConstraintCategory
24 {
27  CONSTRAINT_ASSERTION /* for future expansion */
29 
30 extern Oid CreateConstraintEntry(const char *constraintName,
31  Oid constraintNamespace,
32  char constraintType,
33  bool isDeferrable,
34  bool isDeferred,
35  bool isValidated,
36  Oid relId,
37  const int16 *constraintKey,
38  int constraintNKeys,
39  Oid domainId,
40  Oid indexRelId,
41  Oid foreignRelId,
42  const int16 *foreignKey,
43  const Oid *pfEqOp,
44  const Oid *ppEqOp,
45  const Oid *ffEqOp,
46  int foreignNKeys,
47  char foreignUpdateType,
48  char foreignDeleteType,
49  char foreignMatchType,
50  const Oid *exclOp,
51  Node *conExpr,
52  const char *conBin,
53  const char *conSrc,
54  bool conIsLocal,
55  int conInhCount,
56  bool conNoInherit,
57  bool is_internal);
58 
59 extern void RemoveConstraintById(Oid conId);
60 extern void RenameConstraintById(Oid conId, const char *newname);
61 extern void SetValidatedConstraintById(Oid conId);
62 
63 extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
64  Oid objNamespace, const char *conname);
65 extern char *ChooseConstraintName(const char *name1, const char *name2,
66  const char *label, Oid namespaceid,
67  List *others);
68 
69 extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
70  Oid newNspId, bool isType, ObjectAddresses *objsMoved);
71 extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok);
72 extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok);
73 
74 extern Bitmapset *get_primary_key_attnos(Oid relid, bool deferrableOk,
75  Oid *constraintOid);
76 
77 extern bool check_functional_grouping(Oid relid,
78  Index varno, Index varlevelsup,
79  List *grouping_columns,
80  List **constraintDeps);
81 
82 #endif /* PG_CONSTRAINT_FN_H */
signed short int16
Definition: c.h:255
ConstraintCategory
void RenameConstraintById(Oid conId, const char *newname)
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
Definition: nodes.h:518
unsigned int Oid
Definition: postgres_ext.h:31
Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved)
void SetValidatedConstraintById(Oid conId)
bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, Oid objNamespace, const char *conname)
Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, bool isValidated, Oid relId, const int16 *constraintKey, int constraintNKeys, Oid domainId, Oid indexRelId, Oid foreignRelId, const int16 *foreignKey, const Oid *pfEqOp, const Oid *ppEqOp, const Oid *ffEqOp, int foreignNKeys, char foreignUpdateType, char foreignDeleteType, char foreignMatchType, const Oid *exclOp, Node *conExpr, const char *conBin, const char *conSrc, bool conIsLocal, int conInhCount, bool conNoInherit, bool is_internal)
Definition: pg_constraint.c:49
void RemoveConstraintById(Oid conId)
static char * label
Definition: pg_basebackup.c:81
unsigned int Index
Definition: c.h:365
Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
Bitmapset * get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
Definition: pg_list.h:45
bool check_functional_grouping(Oid relid, Index varno, Index varlevelsup, List *grouping_columns, List **constraintDeps)