From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David Gauthier <dfgpostgres@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: suppress notices from inside a stored a plpgqsl function
Date: Mon, 27 Nov 2023 13:00:19 -0800
Message-ID: <f7fb820d-aa54-4f43-a874-b95ea8be2581@aklaver.com> (raw)
In-Reply-To: <CAEs=6D=m6Gqc0jHQhysOa0t5aBc=NkMhf+eWKExscoSxqWf8zg@mail.gmail.com>
References: <CAEs=6D=m6Gqc0jHQhysOa0t5aBc=NkMhf+eWKExscoSxqWf8zg@mail.gmail.com>
On 11/27/23 12:51, David Gauthier wrote:
> Hi:
>
> I have a plpgsql function that has this...
>
> drop table if exists tmp_diff_blkviews;
>
> Even with the "if exists", I still get...
>
> NOTICE: table "tmp_diff_blkviews" does not exist, skipping
> CONTEXT: SQL statement "drop table if exists tmp_diff_blkviews"
> PL/pgSQL function dvm.blkview_diffs(character varying,character varying)
> line 6 at SQL statement
>
> I want to suppress that. Even if the temp table exists, I don't want
> to hear about how it had to delete the table. Just delete it if it
> exists and be quiet about it.
>
> This function is being called through perl/dbi. So client side command
> line set options, or anything like that, is no good. Is there way to
> control messaging from inside the function ?
>
Per here:
https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE
"Whether messages of a particular priority are reported to the client,
written to the server log, or both is controlled by the log_min_messages
and client_min_messages configuration variables. See Chapter 20 for more
information."
I have not tried it but maybe SET client_min_messages to something above
NOTICE in the function.
Or as part of the function creation:
https://www.postgresql.org/docs/current/sql-createfunction.html
SET configuration_parameter { TO value | = value | FROM CURRENT }
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, dfgpostgres@gmail.com
Subject: Re: suppress notices from inside a stored a plpgqsl function
In-Reply-To: <f7fb820d-aa54-4f43-a874-b95ea8be2581@aklaver.com>
References: <CAEs=6D=m6Gqc0jHQhysOa0t5aBc=NkMhf+eWKExscoSxqWf8zg@mail.gmail.com> <f7fb820d-aa54-4f43-a874-b95ea8be2581@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox