I need to migrate from sql server 2017 to postgreSQL , but I have never used postgreSQL and am having difficulty. I need to convert an array json to values that are inserted into the table.
In sql server I used a insert
with select openjson
and the with
clause to specify what I would get from json .
valores json := '[
{"tipo":"a","valor:"10.89}
{"tipo":"b","valor:"10.88}
{"tipo":"c","valor:"10.87}
{"tipo":"d","valor:"10.86}
]';
insert into dbo.testedojson(valor,tipo)
select *
from json_populate_record(NULL::dbo.testedojson,valores);
I've taken this example in internet to do a test, dbo.testedojson
is the table that will receive the values however there is a syntax error that I can not find.