paulovieira@gmail.com writes:
> drop table if exists temp_table;
> create table temp_table(id int, data json);
> do $$
> declare
> input_data json := '{"id": 1, "data": "abc"}';
> input_row temp_table%ROWTYPE;
> begin
> for input_row in (select * from
> json_populate_record(null::temp_table,input_data)) loop
> raise notice '%', input_row.data;
> end loop;
> end
> $$;
> ERROR: 22P02: invalid input syntax for type json
> DETAIL: Token "abc" is invalid.
This does not seem like a bug, because the value of the data field is
just abc, and that isn't JSON. You'd need something more like
input_data json := '{"id": 1, "data": "\"abc\""}';
regards, tom lane