How to display user-defined functions?

Поиск
Список
Период
Сортировка
От Mark Dalphin
Тема How to display user-defined functions?
Дата
Msg-id 37CC05CF.B69ABE76@amgen.com
обсуждение исходный текст
Ответы Re: [GENERAL] How to display user-defined functions?  (Stuart Rison <stuart@ludwig.ucl.ac.uk>)
Список 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@amgen.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)




В списке pgsql-general по дате отправления:

Предыдущее
От: "amy cheng"
Дата:
Сообщение: do delete/insert instead of update if name changes
Следующее
От: Teodor Cimpoesu
Дата:
Сообщение: Re: [GENERAL] do delete/insert instead of update if name changes