18 #ifndef PG_CONSTRAINT_H
19 #define PG_CONSTRAINT_H
23 #include "catalog/pg_constraint_d.h"
31 CATALOG(pg_constraint,2606,ConstraintRelationId)
110 #ifdef CATALOG_VARLEN
145 int16 confdelsetcols[1];
169 DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, on pg_constraint
using btree(conname name_ops, connamespace oid_ops));
170 DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, on pg_constraint
using btree(conrelid oid_ops, contypid oid_ops, conname name_ops));
171 DECLARE_INDEX(pg_constraint_contypid_index, 2666, ConstraintTypidIndexId, on pg_constraint
using btree(contypid oid_ops));
173 DECLARE_INDEX(pg_constraint_conparentid_index, 2579, ConstraintParentIndexId, on pg_constraint
using btree(conparentid oid_ops));
179 #ifdef EXPOSE_TO_CLIENT_CODE
182 #define CONSTRAINT_CHECK 'c'
183 #define CONSTRAINT_FOREIGN 'f'
184 #define CONSTRAINT_PRIMARY 'p'
185 #define CONSTRAINT_UNIQUE 'u'
186 #define CONSTRAINT_TRIGGER 't'
187 #define CONSTRAINT_EXCLUSION 'x'
209 Oid constraintNamespace,
216 const int16 *constraintKey,
218 int constraintNTotalKeys,
222 const int16 *foreignKey,
227 char foreignUpdateType,
228 char foreignDeleteType,
229 const int16 *fkDeleteSetCols,
230 int numFkDeleteSetCols,
231 char foreignMatchType,
244 const char *conname);
257 bool missing_ok,
Oid *constraintOid);
265 Oid *pf_eq_oprs,
Oid *pp_eq_oprs,
Oid *ff_eq_oprs,
266 int *num_fk_del_set_cols,
AttrNumber *fk_del_set_cols);
270 List *grouping_columns,
271 List **constraintDeps);
#define BKI_LOOKUP(catalog)
#define BKI_LOOKUP_OPT(catalog)
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
DECLARE_TOAST(pg_constraint, 2832, 2833)
bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, const char *conname)
DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, on pg_constraint using btree(conrelid oid_ops, contypid oid_ops, conname name_ops))
DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, on pg_constraint using btree(conname name_ops, connamespace oid_ops))
FormData_pg_constraint * Form_pg_constraint
void RemoveConstraintById(Oid conId)
void RenameConstraintById(Oid conId, const char *newname)
Oid get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, ConstraintOidIndexId, on pg_constraint using btree(oid oid_ops))
void ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId, Oid childTableId)
DECLARE_ARRAY_FOREIGN_KEY((confrelid, confkey), pg_attribute,(attrelid, attnum))
CATALOG(pg_constraint, 2606, ConstraintRelationId)
void DeconstructFkConstraintRow(HeapTuple tuple, int *numfks, AttrNumber *conkey, AttrNumber *confkey, Oid *pf_eq_oprs, Oid *pp_eq_oprs, Oid *ff_eq_oprs, int *num_fk_del_set_cols, AttrNumber *fk_del_set_cols)
void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved)
Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, bool isValidated, Oid parentConstrId, Oid relId, const int16 *constraintKey, int constraintNKeys, int constraintNTotalKeys, Oid domainId, Oid indexRelId, Oid foreignRelId, const int16 *foreignKey, const Oid *pfEqOp, const Oid *ppEqOp, const Oid *ffEqOp, int foreignNKeys, char foreignUpdateType, char foreignDeleteType, const int16 *fkDeleteSetCols, int numFkDeleteSetCols, char foreignMatchType, const Oid *exclOp, Node *conExpr, const char *conBin, bool conIsLocal, int conInhCount, bool conNoInherit, bool is_internal)
bool ConstraintNameExists(const char *conname, Oid namespaceid)
bool check_functional_grouping(Oid relid, Index varno, Index varlevelsup, List *grouping_columns, List **constraintDeps)
Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
DECLARE_ARRAY_FOREIGN_KEY_OPT((conrelid, conkey), pg_attribute,(attrelid, attnum))
Bitmapset * get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
Bitmapset * get_relation_constraint_attnos(Oid relid, const char *conname, bool missing_ok, Oid *constraintOid)