18 #ifndef PG_CONSTRAINT_H
19 #define PG_CONSTRAINT_H
23 #include "catalog/pg_constraint_d.h"
31 CATALOG(pg_constraint,2606,ConstraintRelationId)
116 #ifdef CATALOG_VARLEN
153 int16 confdelsetcols[1];
178 DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, ConstraintNameNspIndexId, pg_constraint, btree(conname name_ops, connamespace oid_ops));
179 DECLARE_UNIQUE_INDEX(pg_constraint_conrelid_contypid_conname_index, 2665, ConstraintRelidTypidNameIndexId, pg_constraint, btree(conrelid oid_ops, contypid oid_ops, conname name_ops));
180 DECLARE_INDEX(pg_constraint_contypid_index, 2666, ConstraintTypidIndexId, pg_constraint, btree(contypid oid_ops));
182 DECLARE_INDEX(pg_constraint_conparentid_index, 2579, ConstraintParentIndexId, pg_constraint, btree(conparentid oid_ops));
190 #ifdef EXPOSE_TO_CLIENT_CODE
193 #define CONSTRAINT_CHECK 'c'
194 #define CONSTRAINT_FOREIGN 'f'
195 #define CONSTRAINT_NOTNULL 'n'
196 #define CONSTRAINT_PRIMARY 'p'
197 #define CONSTRAINT_UNIQUE 'u'
198 #define CONSTRAINT_TRIGGER 't'
199 #define CONSTRAINT_EXCLUSION 'x'
221 Oid constraintNamespace,
228 const int16 *constraintKey,
230 int constraintNTotalKeys,
234 const int16 *foreignKey,
239 char foreignUpdateType,
240 char foreignDeleteType,
241 const int16 *fkDeleteSetCols,
242 int numFkDeleteSetCols,
243 char foreignMatchType,
254 const char *conname);
265 bool is_local,
bool is_no_inherit);
279 bool missing_ok,
Oid *constraintOid);
287 Oid *pf_eq_oprs,
Oid *pp_eq_oprs,
Oid *ff_eq_oprs,
288 int *num_fk_del_set_cols,
AttrNumber *fk_del_set_cols);
290 Oid *containedbyoperoid,
291 Oid *aggedcontainedbyoperoid);
295 List *grouping_columns,
296 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))
HeapTuple findDomainNotNullConstraint(Oid typid)
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)
HeapTuple findNotNullConstraintAttnum(Oid relid, AttrNumber attnum)
void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved)
MAKE_SYSCACHE(CONSTROID, pg_constraint_oid_index, 16)
bool ConstraintNameExists(const char *conname, Oid namespaceid)
bool check_functional_grouping(Oid relid, Index varno, Index varlevelsup, List *grouping_columns, List **constraintDeps)
void FindFKPeriodOpers(Oid opclass, Oid *containedbyoperoid, Oid *aggedcontainedbyoperoid)
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))
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)
bool AdjustNotNullInheritance(Oid relid, AttrNumber attnum, bool is_local, bool is_no_inherit)
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, int16 conInhCount, bool conNoInherit, bool conPeriod, bool is_internal)
List * RelationGetNotNullConstraints(Oid relid, bool cooked, bool include_noinh)