aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-08-16 02:06:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-08-16 02:06:25 +0000
commitb1baf1ff60fdabf2da769a461b22ebe082d1e9e9 (patch)
tree1c651192e1eb6b60e7680a544623527d0b780662 /src/backend
parentbab13a70ff4e4cccd3744747d89c02e99c2968c4 (diff)
downloadpostgresql-b1baf1ff60fdabf2da769a461b22ebe082d1e9e9.tar.gz
postgresql-b1baf1ff60fdabf2da769a461b22ebe082d1e9e9.zip
Add get_func_rettype() to general-use lsyscache routines,
since it's now needed in both optimizer and parser.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/cache/lsyscache.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index cd657ca3272..4f9cd3fefa7 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.32 1999/08/09 03:13:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.33 1999/08/16 02:06:25 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "catalog/pg_operator.h"
+#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
@@ -453,6 +454,31 @@ get_oprjoin(Oid opno)
return (RegProcedure) NULL;
}
+/* ---------- FUNCTION CACHE ---------- */
+
+/*
+ * get_func_rettype
+ * Given procedure id, return the function's result type.
+ */
+Oid
+get_func_rettype(Oid funcid)
+{
+ HeapTuple func_tuple;
+ Oid funcrettype;
+
+ func_tuple = SearchSysCacheTuple(PROOID,
+ ObjectIdGetDatum(funcid),
+ 0, 0, 0);
+
+ if (!HeapTupleIsValid(func_tuple))
+ elog(ERROR, "Function OID %u does not exist", funcid);
+
+ funcrettype = (Oid)
+ ((Form_pg_proc) GETSTRUCT(func_tuple))->prorettype;
+
+ return funcrettype;
+}
+
/* ---------- RELATION CACHE ---------- */
/*