patternMinor
function json_populate_record(..., text) does not exist
Viewed 0 times
textfunctionexistdoesnotjson_populate_record
Problem
I went by the example from the docu which went fine:
But my self-constructed JSON simplified similar to this did not work :-(
resulting in:
select * from json_populate_record(null::x, '{"a":1,"b":2}')But my self-constructed JSON simplified similar to this did not work :-(
-- p_some_num of type int
select * from json_populate_record( null:my_record_type, '{"a":'||p_some_num||'',"b":2}' )resulting in:
ERROR: function json_populate_record(my_record_type, text) does not existSolution
I should have read more carefully and was not aware of the implicit
text to json conversion in the example. After some fiddling around with what was wrong, of course the following works:select * from json_populate_record(
null:my_record_type, ('{"a":'||p_some_num||'',"b":2}')::json )Code Snippets
select * from json_populate_record(
null:my_record_type, ('{"a":'||p_some_num||'',"b":2}')::json )Context
StackExchange Database Administrators Q#123053, answer score: 3
Revisions (0)
No revisions yet.