summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-06-25 03:56:31 +0000
committerBruce Momjian <bruce@momjian.us>2003-06-25 03:56:31 +0000
commitca64391d6ca5a8aef6876961f2a8517e014b472d (patch)
treece5136d0f4800d445ee50fb1840c11213987917f /src/backend/utils/cache/lsyscache.c
parentbe94f198c368dcc4fcd99e65f9d392118f471529 (diff)
Updated the pg_get_constraintdef() to use conbin. Update pg_dump to use
pg_get_constraintdef() for >= 70400. Rod Taylor <rbt@rbt.ca>
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index a4fcd3fc286..2c0c6457918 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.97 2003/06/24 23:14:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.98 2003/06/25 03:56:31 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1444,6 +1444,37 @@ get_typtype(Oid typid)
}
/*
+ * get_typname
+ * Returns the name of a given type.
+ *
+ * Returns a palloc'd copy of the string, or NULL if no such relation.
+ *
+ * NOTE: since type name is not unique, be wary of code that uses this
+ * for anything except preparing error messages.
+ */
+char *
+get_typname(Oid typid)
+{
+ HeapTuple tp;
+
+ tp = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(typid),
+ 0, 0, 0);
+ if (HeapTupleIsValid(tp))
+ {
+ Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
+ char *result;
+
+ result = pstrdup(NameStr(typtup->typname));
+ ReleaseSysCache(tp);
+ return result;
+ }
+ else
+ return NULL;
+}
+
+
+/*
* get_typ_typrelid
*
* Given the type OID, get the typrelid (InvalidOid if not a complex