How can I fix the error with json_object in postgresql-9.6?

爷,独闯天下 提交于 2021-02-11 14:21:40

问题


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

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.


回答1:


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


来源:https://stackoverflow.com/questions/59983353/how-can-i-fix-the-error-with-json-object-in-postgresql-9-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!