Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uK1yQ-00Bzvp-E1 for pgsql-admin@arkaria.postgresql.org; Tue, 27 May 2025 21:36:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uK1yP-00BMN4-6K for pgsql-admin@arkaria.postgresql.org; Tue, 27 May 2025 21:36:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uK1yO-00BMMv-QU for pgsql-admin@lists.postgresql.org; Tue, 27 May 2025 21:36:36 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uK1yM-000R3U-09 for pgsql-admin@lists.postgresql.org; Tue, 27 May 2025 21:36:36 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-acacb8743a7so45479366b.1 for ; Tue, 27 May 2025 14:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1748381794; x=1748986594; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=EDtbVPH1Y233Yv4DGa/vbdzvAqFTvCWjibJkJL/9RT8=; b=O+E77S/YAkPRzwLvHkrbvdDESHatN/ed7ttDJ21xSxoJpVTFRpk1sWQciQa9EX9gqr Lcaw2q2AngLuT8hazAG61E281TNpvLkyrpy1l+9UfbGN4nxYGb1WDMnzcC1iKjxecZcL 1V0k+GspdGoiWoWmv55mgr0r38o6ZnqyrVH58mM1fhlyIO5uz4QdjZ1vjWWOWxCuBfSC p8wwIw4igUp49wrCX9XqG62mxfIpNmPa3ybvSKiyPtzWBF1clA2R8EJtosUqwCZdyoe7 jJHI6L/HfzOa7rXNlSc3urFPZv0hsWRObOMcI6uDtmv4Aj9sRlcQbWautRD42mnVDfiX aonw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748381794; x=1748986594; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EDtbVPH1Y233Yv4DGa/vbdzvAqFTvCWjibJkJL/9RT8=; b=XTb7i+ukhWWPd0NDQ8uC1ULRjaLZg4bGr2UXXs2c3km5MqFqEp0M4Y+aE6DAl3Ppj5 9NgEXqltcsJUHGMx7aqwD9FsTAgkBYiWo+Ar2lraP0jKzsFSeW+aqbcTmLP77jePBzNE QhnNqfxGRGxSEtamF2uw/gFE25u+HeH7Qgxg/VaFpeacsbq1n0qH/ePeXWP8RAGJK+7V /hzgwQiZW77bjG8OWvWWHC0vJkI4RUBMs/j1UgyQKX2kjwmkuyTlaCHzbO/FCwl/KnQ/ wyFDt+h5+NgGjaeOzX3teMV2Ks63X15szBpsoC0H2/syVnC4Ehj8G1ZGQ8v0Yh8RtiEV y/jQ== X-Forwarded-Encrypted: i=1; AJvYcCXdXlPhxryesoMktp0FJ35htaQQFen2eWQILy93GJxlQ81PmW2xajnd6bxHgRUm74Whgn2zVsKrFUVB3w==@lists.postgresql.org X-Gm-Message-State: AOJu0YxjSBiNcKtcEWhcwTzWMdoCTOy9t1LJxeBd9Vt54MjQYV/oDzm6 nD+55ZgxEKfhe5uhOYrIpFJ+TxV61twFqkHOW/NVWpQW0m0CgTnVwmr+r9eWrlep2hc= X-Gm-Gg: ASbGncvkEBGOGjtkDmqC1iDCw8aetmcbSkzYcPtXGY5+d0wC3eVQ5XjUPVuefKdX3VF oXSDObxksvg0+4bs2ykOtoc2K0dp+mYWpxX0u7OlIr8BBlzlTts+DBacNWKoI9uH2h+33jsz+Pq yGWvsmZda++8thiRbeZ9vceOxDv8PVSfd98uiWR6SdvAmqof4/ptRH+5wXfdInGKhtFMWsN0u2V U7ngk8/vj+XrkO+u7e2TLgiYlSwq52XIV0mA0nEVq/GsN/LmFstt0bx5qrxpi6U81kO9kpGE5p3 lVjtOf4BAYiaLlE3xoEW9T3tPQUEPhrHO70Mnd4YDfHrt8OuOrVja6SgCOVZc+inqZOMV7jSn7c zkDjNhA== X-Google-Smtp-Source: AGHT+IEgISUW/6uznYX8N6ZWlVNNdmntTiSj+ovC9T4L5rOw6EMu6LutPIGUm9CoQOvAjbSq1gHV2g== X-Received: by 2002:a17:907:3f10:b0:ad5:4998:9f1a with SMTP id a640c23a62f3a-ad89886a389mr218549666b.5.1748381793685; Tue, 27 May 2025 14:36:33 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:b596:4291:490c:7ad5:d374]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad89f0884besm15360566b.50.2025.05.27.14.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:36:33 -0700 (PDT) Message-ID: <6451fea051cfa5a4bbc15941f1e2082216195d43.camel@cybertec.at> Subject: Re: How to check if a Procedure or FUNCTION EXIST From: Laurenz Albe To: Edwin UY , Pgsql-admin Date: Tue, 27 May 2025 23:36:32 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-1.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2025-05-28 at 03:01 +1200, Edwin UY wrote: > Probably a dumb question of sorts.=C2=A0 > I want to check for function and procedure if they exist or not including= those > created by the users as well as system functions >=20 > 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 =3D 'whatever'; Yours, Laurenz Albe