postgresql-9.0.15 on CentOS 6.5. 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 (1.18.1 for win2003) 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 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 just in case. Same behaviour.
I asked on the postgresql-general mailing list and received an informative answer: what distinguishes INFO
from NOTICE
is that INFO
does not have a level: it's intended to always go through, no matter what client_min_messages
or anything else is set to, from functions that you would call specifically for INFO output. So in my case, the appropriate thing is to output only NOTICE
from my function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With