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, pg_constraint, btree(conname name_ops, connamespace oid_ops));
170 DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, pg_constraint, btree(conrelid oid_ops, contypid oid_ops, conname name_ops));
171 DECLARE_INDEX(pg_constraint_contypid_index, 2666, ConstraintTypidIndexId, pg_constraint, btree(contypid oid_ops));
173 DECLARE_INDEX(pg_constraint_conparentid_index, 2579, ConstraintParentIndexId, pg_constraint, btree(conparentid oid_ops));
179 #ifdef EXPOSE_TO_CLIENT_CODE
182 #define CONSTRAINT_CHECK 'c'
183 #define CONSTRAINT_FOREIGN 'f'
184 #define CONSTRAINT_NOTNULL 'n'
185 #define CONSTRAINT_PRIMARY 'p'
186 #define CONSTRAINT_UNIQUE 'u'
187 #define CONSTRAINT_TRIGGER 't'
188 #define CONSTRAINT_EXCLUSION 'x'
210 Oid constraintNamespace,
217 const int16 *constraintKey,
219 int constraintNTotalKeys,
223 const int16 *foreignKey,
228 char foreignUpdateType,
229 char foreignDeleteType,
230 const int16 *fkDeleteSetCols,
231 int numFkDeleteSetCols,
232 char foreignMatchType,
242 const char *conname);
266 bool missing_ok,
Oid *constraintOid);
274 Oid *pf_eq_oprs,
Oid *pp_eq_oprs,
Oid *ff_eq_oprs,
275 int *num_fk_del_set_cols,
AttrNumber *fk_del_set_cols);
279 List *grouping_columns,
280 List **constraintDeps);
#define BKI_LOOKUP(catalog)
#define BKI_LOOKUP_OPT(catalog)
DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, pg_constraint, btree(conrelid oid_ops, contypid oid_ops, conname name_ops))
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
HeapTuple findNotNullConstraint(Oid relid, const char *colname)
DECLARE_TOAST(pg_constraint, 2832, 2833)
bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, const char *conname)
FormData_pg_constraint * Form_pg_constraint
void RemoveConstraintById(Oid conId)
void RenameConstraintById(Oid conId, const char *newname)
DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, pg_constraint, btree(conname name_ops, connamespace oid_ops))
Oid get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
DECLARE_UNIQUE_INDEX_PKEY(pg_constraint_oid_index, 2667, ConstraintOidIndexId, pg_constraint, btree(oid oid_ops))
void ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId, Oid childTableId)
DECLARE_ARRAY_FOREIGN_KEY((confrelid, confkey), pg_attribute,(attrelid, attnum))
List * RelationGetNotNullConstraints(Oid relid, bool cooked)
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 AdjustNotNullInheritance(Oid relid, Bitmapset *columns, int count)
HeapTuple findNotNullConstraintAttnum(Oid relid, AttrNumber attnum)
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)
AttrNumber extractNotNullColumn(HeapTuple constrTup)
DECLARE_ARRAY_FOREIGN_KEY_OPT((conrelid, conkey), pg_attribute,(attrelid, attnum))
bool AdjustNotNullInheritance1(Oid relid, AttrNumber attnum, int count, bool is_no_inherit)
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)