How to display user-defined functions?

From: Mark Dalphin <mdalphin(at)amgen(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to display user-defined functions?
Date: 1999-08-31 16:41:51
Message-ID: 37CC05CF.B69ABE76@amgen.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Is there a way to display user-defined functions? For example, if I define a
function using PL/pgsql, what tables do I query and in what way to learn that
the function exisits and further, what its defintion is? I can find functions
that return known types, eg getTimeStamp, below, shows up with '\df', however
functions defined returning type "opaque" do not show up, eq,
"exon_foreign_keys", below.

As a wish list, a command like, '\dF' to display functions I have defined,
including those returning opaque would be nice.

---------------------------------------------------
-- Listed by '\df' amongst many other functions
CREATE FUNCTION getTimeStamp() RETURNS timestamp AS '
DECLARE
cur_time timestamp;
BEGIN
cur_time = ''now'';
RETURN cur_time;
END;
' LANGUAGE 'plpgsql';

--------------------------------------
-- Not listed by '\df' or by any other means I can locate
CREATE FUNCTION exon_foreign_keys() RETURNS opaque AS '
DECLARE
zhvt_row zhvt%ROWTYPE;
BEGIN
IF NEW.zhvtID ISNULL THEN
RAISE EXCEPTION ''zhvtID can not be NULL'';
END IF;

SELECT * INTO zhvt_row FROM zhvt WHERE zhvtID = NEW.zhvtID;
IF NOT FOUND THEN
RAISE EXCEPTION ''zhvtID = % is not in TABLE zhvt'' , NEW.zhvtID;
END IF;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';

Thanks,
Mark

--
Mark Dalphin email: mdalphin(at)amgen(dot)com
Mail Stop: 29-2-A phone: +1-805-447-4951 (work)
One Amgen Center Drive +1-805-375-0680 (home)
Thousand Oaks, CA 91320 fax: +1-805-499-9955 (work)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart Rison 1999-08-31 17:46:57 Re: [GENERAL] How to display user-defined functions?
Previous Message Marzullo Laurent 1999-08-31 13:54:47 PostgreSQL table data structure generator...