pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedjson_populate_recordset
3+ messages / 2 participants
[nested] [flat]
* json_populate_recordset
@ 2018-06-07 16:51 Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-07 16:56 ` Re: json_populate_recordset Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Klaver @ 2018-06-07 16:51 UTC (permalink / raw)
To: pgsql-general
From here:
https://www.postgresql.org/docs/10/static/functions-json.html
select * from json_populate_record(null::myrowtype, '{"a": 1, "b": ["2",
"a b"], "c": {"d": 4, "e": "a b c"}}')
What is the null::myrowtype doing?
Thanks,
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: json_populate_recordset
2018-06-07 16:51 json_populate_recordset Adrian Klaver <adrian.klaver@aklaver.com>
@ 2018-06-07 16:56 ` Pavel Stehule <pavel.stehule@gmail.com>
2018-06-07 18:32 ` Re: json_populate_recordset Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Stehule @ 2018-06-07 16:56 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general
2018-06-07 18:51 GMT+02:00 Adrian Klaver <adrian.klaver@aklaver.com>:
> From here:
>
> https://www.postgresql.org/docs/10/static/functions-json.html
>
> select * from json_populate_record(null::myrowtype, '{"a": 1, "b": ["2",
> "a b"], "c": {"d": 4, "e": "a b c"}}')
>
> What is the null::myrowtype doing?
>
this function uses polymorphic parameters - its some like
create or replace function fx(in anyelement, json) returns anyelement ..
output polymorphic value requires minimally one input polymorphic value for
type specification. Postgres has not possibility to pass only datatype - so
pattern null:type is used instead.
Regards
Pavel
>
>
> Thanks,
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: json_populate_recordset
2018-06-07 16:51 json_populate_recordset Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-07 16:56 ` Re: json_populate_recordset Pavel Stehule <pavel.stehule@gmail.com>
@ 2018-06-07 18:32 ` Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 3+ messages in thread
From: Adrian Klaver @ 2018-06-07 18:32 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-general
On 06/07/2018 09:56 AM, Pavel Stehule wrote:
>
>
> 2018-06-07 18:51 GMT+02:00 Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>>:
>
> From here:
>
> https://www.postgresql.org/docs/10/static/functions-json.html
> <https://www.postgresql.org/docs/10/static/functions-json.html;
>
> select * from json_populate_record(null::myrowtype, '{"a": 1, "b":
> ["2", "a b"], "c": {"d": 4, "e": "a b c"}}')
>
> What is the null::myrowtype doing?
>
>
> this function uses polymorphic parameters - its some like
>
> create or replace function fx(in anyelement, json) returns anyelement ..
>
> output polymorphic value requires minimally one input polymorphic value
> for type specification. Postgres has not possibility to pass only
> datatype - so pattern null:type is used instead.
Alright, so it is bootstrapping a polymorphic type off null. Thanks.
>
> Regards
>
> Pavel
>
>
>
> Thanks,
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-06-07 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 16:51 json_populate_recordset Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-07 16:56 ` Pavel Stehule <pavel.stehule@gmail.com>
2018-06-07 18:32 ` 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