如何修复 postgresql-9.6 中 json_object 的错误? [英] How can I fix the error with json_object in postgresql-9.6?
问题描述
有带 PostgreSQL 数据库监控的 Zabbix.Zabbix 中有一个触发器不断发送垃圾邮件错误:
There is Zabbix with PostgreSQL database monitoring. There is one trigger in Zabbix that constantly spam error:
ERROR: function json_object(text[], text[]) does not exist
LINE 11: SELECT json_object(array_agg(name), array_agg(setting)) F...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 190
找到一个模板,在其中注册了此触发器.这是标准的,我试图在 Postgres 中单独请求一行,结果是同样的错误.请求本身:
Found a template in which this trigger is registered. It is standard, I tried to request a line separately in Postgres, as a result the same error. The request itself:
select json_build_object('extensions',(select array_agg(extname) from (select extname from pg_extension order by extname) as e),'settings', (select json_object(array_agg(name),array_agg(setting)) from (select name,setting from pg_settings where name != 'application_name' order by name) as s));
我请你告诉我哪里出了问题.
I ask you to tell what is wrong.
推荐答案
json_object(text[], text[])
函数存在于 PostgreSQL (文档) 自 9.4 版起.您确定您使用的是 9.4 或更高版本吗?您可以通过以下方式查看:
The function json_object(text[], text[])
exists in PostgreSQL (documentation) since version 9.4.
Are you sure you use the version 9.4 or above ? You can check with:
SELECT version();
这篇关于如何修复 postgresql-9.6 中 json_object 的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!