pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedRETURNING to_jsonb(...)
2+ messages / 2 participants
[nested] [flat]
* RETURNING to_jsonb(...)
@ 2020-05-05 20:11 Miles Elam <miles.elam@productops.com>
0 siblings, 1 reply; 2+ messages in thread
From: Miles Elam @ 2020-05-05 20:11 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
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(*);
Thanks in advance
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: RETURNING to_jsonb(...)
@ 2020-05-05 20:25 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Miles Elam <miles.elam@productops.com>
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Klaver @ 2020-05-05 20:25 UTC (permalink / raw)
To: Miles Elam <miles.elam@productops.com>; pgsql-general <pgsql-general@lists.postgresql.org>
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@aklaver.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-05-05 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 20:11 RETURNING to_jsonb(...) Miles Elam <miles.elam@productops.com>
2020-05-05 20:25 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox