aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-09-19 23:40:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-09-19 23:40:56 +0000
commitda395b56cd0844f73232961fe0823f4c224bc721 (patch)
treebb7ef806205c2f5bd123d8ef0975655bebaaa5ff /src/backend/utils/cache
parent4a0c3a6142698c7f2f99230679dc80cd9d7e5e4e (diff)
downloadpostgresql-da395b56cd0844f73232961fe0823f4c224bc721.tar.gz
postgresql-da395b56cd0844f73232961fe0823f4c224bc721.zip
Tweak heap.c to refuse attempts to create table columns of standalone
composite types. Add a couple more lsyscache.c routines to support this, and make use of them in some other places that were doing lookups the hard way.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/lsyscache.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index c8a038d8a7d..ae77dacd13a 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.84 2002/09/18 21:35:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.85 2002/09/19 23:40:56 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -776,6 +776,33 @@ get_rel_type_id(Oid relid)
return InvalidOid;
}
+/*
+ * get_rel_relkind
+ *
+ * Returns the relkind associated with a given relation.
+ */
+char
+get_rel_relkind(Oid relid)
+{
+ HeapTuple tp;
+
+ tp = SearchSysCache(RELOID,
+ ObjectIdGetDatum(relid),
+ 0, 0, 0);
+ if (HeapTupleIsValid(tp))
+ {
+ Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
+ char result;
+
+ result = reltup->relkind;
+ ReleaseSysCache(tp);
+ return result;
+ }
+ else
+ return '\0';
+}
+
+
/* ---------- TYPE CACHE ---------- */
/*
@@ -1154,6 +1181,33 @@ get_typtype(Oid typid)
}
/*
+ * get_typ_typrelid
+ *
+ * Given the type OID, get the typrelid (InvalidOid if not a complex
+ * type).
+ */
+Oid
+get_typ_typrelid(Oid typid)
+{
+ HeapTuple tp;
+
+ tp = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(typid),
+ 0, 0, 0);
+ if (HeapTupleIsValid(tp))
+ {
+ Form_pg_type typtup = (Form_pg_type) GETSTRUCT(tp);
+ Oid result;
+
+ result = typtup->typrelid;
+ ReleaseSysCache(tp);
+ return result;
+ }
+ else
+ return InvalidOid;
+}
+
+/*
* getTypeInputInfo
*
* Get info needed for converting values of a type to internal form