本文介绍了尽管有"SET client_min_messages TO WARNING"的信息输出,就在之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

postgresql-9.0.15.我有一个plperlu函数,它输出INFO消息.我想在测试期间抑制它(使用psql,它的行为也如下所示),但我什至似乎无法从pgAdminIII(对于Win2003为1.18.1)查询窗口来做到这一点:

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')

我运行它,然后在消息"标签中查看,并且有我的INFO消息.

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

(这可能类似于如何隐藏INFO消息当运行psql脚本时,但是我不想在整个会话中禁用INFO消息,只是一部分,然后将最小值设置回NOTICE.)

(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.)

上述代码片段在做什么? client_min_messages不适用于pl/perlu函数吗?

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

更新:经过进一步调查,即使使用plpgsql函数,而不仅仅是plperlu函数,它似乎也会发生:

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();

我在pgAdminIII查询窗口中运行了以上代码段,并且此消息不应出现"出现在消息选项卡中. oi?

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

更新2:我还尝试了 log_min_messages ,以防万一.行为相同.

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

推荐答案

我在PostgreSQL一般邮件列表上询问并收到一个有用的答案:INFONOTICE的区别是INFO没有一个级别:无论您设置了什么client_min_messages或任何其他设置,它都应始终从您专门为INFO输出调用的函数中进行遍历.因此,就我而言,适当的事情是仅从函数中输出NOTICE.

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.

这篇关于尽管有"SET client_min_messages TO WARNING"的信息输出,就在之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 14:16