summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-02-03 21:15:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-02-03 21:15:45 +0000
commit3752e85bad45e98383ea1c9e7e7dbaf13f41da7e (patch)
treece6735a837cf169d82744b7877630494d35ce65a /src/backend/utils/cache/lsyscache.c
parent464598b637cfabde01695a27a32ed8f133d127d7 (diff)
Determine the set of constraints applied to a domain at executor
startup, not in the parser; this allows ALTER DOMAIN to work correctly with domain constraint operations stored in rules. Rod Taylor; code review by Tom Lane.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index a6c838974c0..abc00a9204e 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.89 2003/01/15 19:35:44 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.90 2003/02/03 21:15:44 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1013,6 +1013,33 @@ get_typstorage(Oid typid)
}
/*
+ * get_typtypmod
+ *
+ * Given the type OID, return the typtypmod field (domain's typmod
+ * for base type)
+ */
+int32
+get_typtypmod(Oid typid)
+{
+ HeapTuple tp;
+
+ tp = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(typid),
+ 0, 0, 0);
+ if (HeapTupleIsValid(tp))
+ {
+ Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
+ int32 result;
+
+ result = typtup->typtypmod;
+ ReleaseSysCache(tp);
+ return result;
+ }
+ else
+ return -1;
+}
+
+/*
* get_typdefault
* Given a type OID, return the type's default value, if any.
*