Re: How to check if a Procedure or FUNCTION EXIST

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: How to check if a Procedure or FUNCTION EXIST
Дата
Msg-id 6451fea051cfa5a4bbc15941f1e2082216195d43.camel@cybertec.at
обсуждение исходный текст
Ответ на How to check if a Procedure or FUNCTION EXIST  (Edwin UY <edwin.uy@gmail.com>)
Список 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 по дате отправления: