diff options
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 26368ffcc97..48a280d089b 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -1133,6 +1133,28 @@ get_constraint_index(Oid conoid) return InvalidOid; } +/* + * get_constraint_type + * Return the pg_constraint.contype value for the given constraint. + * + * No frills. + */ +char +get_constraint_type(Oid conoid) +{ + HeapTuple tp; + char contype; + + tp = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conoid)); + if (!HeapTupleIsValid(tp)) + elog(ERROR, "cache lookup failed for constraint %u", conoid); + + contype = ((Form_pg_constraint) GETSTRUCT(tp))->contype; + ReleaseSysCache(tp); + + return contype; +} + /* ---------- LANGUAGE CACHE ---------- */ char * |