我参考了文档中的示例,它运行良好:
select * from json_populate_record(null::x, '{"a":1,"b":2}')
Run Code Online (Sandbox Code Playgroud)
但是我自己构建的 JSON 简化类似于这样没有工作:-(
-- p_some_num of type int
select * from json_populate_record( null:my_record_type, '{"a":'||p_some_num||'',"b":2}' )
Run Code Online (Sandbox Code Playgroud)
导致:
ERROR: function json_populate_record(my_record_type, text) does not exist
Run Code Online (Sandbox Code Playgroud)