summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-03-26 19:17:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-03-26 19:17:02 +0000
commit1dbf8aa7a8159875bb46f6ee6ab0116eee76869b (patch)
tree9aa08b4247dc230b6d35aa9c34b488b36b716693 /src/backend/utils/cache/lsyscache.c
parentda631e931f9da4bc5df4bfd39f0c42684adfb8e5 (diff)
downloadpostgresql-1dbf8aa7a8159875bb46f6ee6ab0116eee76869b.tar.gz
pg_class has a relnamespace column. You can create and access tables
in schemas other than the system namespace; however, there's no search path yet, and not all operations work yet on tables outside the system namespace.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 1157780111..82be75ac79 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.65 2002/03/22 02:56:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.66 2002/03/26 19:16:09 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -634,6 +634,21 @@ func_iscachable(Oid funcid)
/* ---------- RELATION CACHE ---------- */
+/*
+ * get_relname_relid
+ * Given name and namespace of a relation, look up the OID.
+ *
+ * Returns InvalidOid if there is no such relation.
+ */
+Oid
+get_relname_relid(const char *relname, Oid relnamespace)
+{
+ return GetSysCacheOid(RELNAMENSP,
+ PointerGetDatum(relname),
+ ObjectIdGetDatum(relnamespace),
+ 0, 0);
+}
+
#ifdef NOT_USED
/*
* get_relnatts
@@ -664,10 +679,12 @@ get_relnatts(Oid relid)
/*
* get_rel_name
- *
* Returns the name of a given relation.
*
- * Note: returns a palloc'd copy of the string, or NULL if no such relation.
+ * Returns a palloc'd copy of the string, or NULL if no such relation.
+ *
+ * NOTE: since relation name is not unique, be wary of code that uses this
+ * for anything except preparing error messages.
*/
char *
get_rel_name(Oid relid)