On 5/5/20 1:11 PM, Miles Elam wrote:
How can the new record returned from RETURNING to converted to jsonb? For example something like: INSERT INTO my_table (a, b, c) VALUES ('a', 'b', 'c') RETURNING to_jsonb(*); or UPDATE my_table SET a = 'a' RETURNING to_jsonb(*); or INSERT INTO my_table (a, b, c) VALUES ('a', 'b', 'c') ON CONFLICT DO UPDATE SET a = EXCLUDED.a RETURNING to_jsonb(*);
insert into sample_tbl values(3, 2) returning to_jsonb(sample_tbl.*); to_jsonb ----------------------------------- {"sample_id": 3, "freezer_fk": 2} (1 row)
Thanks in advance
-- Adrian Klaver adrian.klaver@xxxxxxxxxxx