diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index cd657ca32729b1cb52a3da3ee86da63ff0e585ca..4f9cd3fefa71784cb7d3dcc14b38a8a04e7c657a 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 ---------- */ /* diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 4ca8fddda108359a512ef2077c425c70245dee66..3686b13c5f06c6abfba88a679f3cf8b58d11ac0c 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lsyscache.h,v 1.19 1999/08/09 03:13:28 tgl Exp $ + * $Id: lsyscache.h,v 1.20 1999/08/16 02:06:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,7 @@ extern HeapTuple get_operator_tuple(Oid opno); extern Oid get_negator(Oid opid); extern RegProcedure get_oprrest(Oid opid); extern RegProcedure get_oprjoin(Oid opid); +extern Oid get_func_rettype(Oid funcid); extern int get_relnatts(Oid relid); extern char *get_rel_name(Oid relid); extern struct varlena *get_relstub(Oid relid, int no, bool *islast);