How to check if a Procedure or FUNCTION EXIST - Mailing list pgsql-admin

From Edwin UY
Subject How to check if a Procedure or FUNCTION EXIST
Date
Msg-id CA+wokJ_fJphYtOFxd2nHV7P6B9YdhN3=cOcevGHXPd50iUvreQ@mail.gmail.com
Whole thread Raw
Responses Re: How to check if a Procedure or FUNCTION EXIST
List pgsql-admin
Hi,

Probably a dumb question of sorts. 
I want to check for function and procedure if they exist or not including those created by the users as well as system functions

Reading thru the following link


SELECT EXISTS (
        SELECT *
        FROM pg_catalog.pg_proc
        JOIN pg_namespace ON pg_catalog.pg_proc.pronamespace = pg_namespace.oid
        WHERE proname = 'proc_name'
            AND pg_namespace.nspname = 'schema_name'
        )


Will querying pg_catalog.pg_proc be enough? Using prokind to check if it is function or procedure and proowner whether it is a system function or user-defined?

Regards,
Ed

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Tables in public schema
Next
From: "David G. Johnston"
Date:
Subject: Re: How to check if a Procedure or FUNCTION EXIST