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

From Laurenz Albe
Subject Re: How to check if a Procedure or FUNCTION EXIST
Date
Msg-id 6451fea051cfa5a4bbc15941f1e2082216195d43.camel@cybertec.at
Whole thread Raw
In response to How to check if a Procedure or FUNCTION EXIST  (Edwin UY <edwin.uy@gmail.com>)
List pgsql-admin
On Wed, 2025-05-28 at 03:01 +1200, Edwin UY wrote:
> 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
>
> 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?

That would simply be

  SELECT pronamespace::regprocedure AS "schema",
         oid::regprocedure
  FROM pg_proc
  WHERE proname = 'whatever';

Yours,
Laurenz Albe



pgsql-admin by date:

Previous
From: Usman Khan
Date:
Subject: Re: pgAdmin 4 in web mode on an Ubuntu 20.04 (Focal) system.
Next
From: Edwin UY
Date:
Subject: Re: How to check if a Procedure or FUNCTION EXIST