-- check existence of functions and overloads /* to_regproc(text) returns the OID of the function if it exists to_regproc(text) only works when: - function name exists - and only one match exists in pg_proc Meaning, if the function is overloaded, to_regproc(text) will return NULL NOTE: For overloaded functions, make use of to_regprocedure(text) */ -- test if ad_to_bs exists SELECT to_regproc('ad_to_bs') IS NOT NULL; SELECT to_regprocedure('ad_to_bs(date)') IS NOT NULL; SELECT pg_typeof(ad_to_bs('2001-02-01')); -- test if current_bs_date exists SELECT to_regproc('current_bs_date') IS NOT NULL; SELECT pg_typeof(current_bs_date()); -- test if to_char overloads for bs_date exist SELECT to_regprocedure('to_char(bs_date, text)') IS NOT NULL; SELECT to_regprocedure('to_char(bs_date, text, text)') IS NOT NULL;