public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Edwin UY <[email protected]>
To: Pgsql-admin <[email protected]>
Subject: Re: How to check if a Procedure or FUNCTION EXIST
Date: Tue, 27 May 2025 23:36:32 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+wokJ_fJphYtOFxd2nHV7P6B9YdhN3=cOcevGHXPd50iUvreQ@mail.gmail.com>
References: <CA+wokJ_fJphYtOFxd2nHV7P6B9YdhN3=cOcevGHXPd50iUvreQ@mail.gmail.com>
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
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: How to check if a Procedure or FUNCTION EXIST
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox