Search Postgresql Archives

Re: RETURNING to_jsonb(...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux