Обсуждение: client_min_messages not suppressing messages in psql nor pgAdminIII

Поиск
Список
Период
Сортировка

client_min_messages not suppressing messages in psql nor pgAdminIII

От
Kevin Field
Дата:
This is a cross-post from
http://stackoverflow.com/questions/21238209/info-output-despite-set-client-min-messages-to-warning-just-before
since I'm not getting any answers there yet.

With postgresql-9.0.15 on CentOS 6.5 (accessed via pgAdminIII 1.18.1 on
Win2003), I have a plperlu function that outputs an INFO message.  I
want to suppress it during testing (using psql, which also behaves as
below), but I can't even seem to do it from a pgAdminIII query window:

     SET client_min_messages TO WARNING;
     select my_info_outputting_function('lalala')

I run that and look in the "messages" tab, and there's my INFO message.

(This may appear similar to
http://stackoverflow.com/questions/11404206/how-to-suppress-info-messages-when-running-psql-scripts
, but I don't want to disable INFO messages for my whole session, just
part of it and then set the minimum back to NOTICE.)

What am I doing wrong with the above code snippet?  Does
client_min_messages not apply to pl/perlu functions?

UPDATE: upon further investigation, it seems to happen even with plpgsql
functions, not just plperlu functions:

     create or replace function my_info_outputting_function() returns
void as $$
     begin
         raise INFO 'this should not appear...';
         return;
     end;
     $$ language plpgsql;
     SET client_min_messages TO WARNING;
     select my_info_outputting_function();

I run the above snippet in a pgAdminIII query window and "this should
not appear" appears in the messages tab.  Quoi?

Update 2: I also tried [log_min_messages][1] just in case.  Same behaviour.

Any ideas?

Thanks,
Kev


   [1]:
http://bytes.com/topic/postgresql/answers/423022-supressing-notice-messages-windows-cygwin-only-not-working


Re: client_min_messages not suppressing messages in psql nor pgAdminIII

От
Jeff Janes
Дата:
On Tue, Jan 21, 2014 at 7:57 AM, Kevin Field <kev@brantaero.com> wrote:
This is a cross-post from http://stackoverflow.com/questions/21238209/info-output-despite-set-client-min-messages-to-warning-just-before since I'm not getting any answers there yet.

With postgresql-9.0.15 on CentOS 6.5 (accessed via pgAdminIII 1.18.1 on Win2003), I have a plperlu function that outputs an INFO message.  I want to suppress it during testing (using psql, which also behaves as below), but I can't even seem to do it from a pgAdminIII query window:

Why not use NOTICE?  INFO is supposed to be used for things the user *requested* to see (for example, by supplying the "verbose" option to one of the commands which take that option).
 
The documentation could be clearer on this, but it seems to suggest that there is no way to turn off INFO to the client.

Cheers,

Jeff

Re: client_min_messages not suppressing messages in psql nor pgAdminIII

От
Tom Lane
Дата:
Jeff Janes <jeff.janes@gmail.com> writes:
> Why not use NOTICE?  INFO is supposed to be used for things the user
> *requested* to see (for example, by supplying the "verbose" option to one
> of the commands which take that option).

> The documentation could be clearer on this, but it seems to suggest that
> there is no way to turn off INFO to the client.

Yeah.  Per elog.h:

#define INFO        17          /* Messages specifically requested by user (eg
                                 * VACUUM VERBOSE output); always sent to
                                 * client regardless of client_min_messages,
                                 * but by default not sent to server log. */

You should not be using level INFO unless you are responding to an
explicit client request to get the output.  If memory serves, we'd
not even have invented that level except that VACUUM VERBOSE existed
before we invented the elog levels, and we wanted to preserve its
always-print-the-results behavior.

            regards, tom lane


Re: client_min_messages not suppressing messages in psql nor pgAdminIII

От
Kevin Field
Дата:
>> Why not use NOTICE?  INFO is supposed to be used for things the user
>> *requested* to see (for example, by supplying the "verbose" option to one
>> of the commands which take that option).
>
>> The documentation could be clearer on this, but it seems to suggest that
>> there is no way to turn off INFO to the client.
>
> Yeah.  Per elog.h:
>
> #define INFO        17          /* Messages specifically requested by user (eg
>                                   * VACUUM VERBOSE output); always sent to
>                                   * client regardless of client_min_messages,
>                                   * but by default not sent to server log. */
>
> You should not be using level INFO unless you are responding to an
> explicit client request to get the output.  If memory serves, we'd
> not even have invented that level except that VACUUM VERBOSE existed
> before we invented the elog levels, and we wanted to preserve its
> always-print-the-results behavior.

Thank you very much Jeff and Tom for the clarification!  This was
bugging me, and I'm glad to know the right thing to do now.  :)

Kev