pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: json_populate_recordset
Date: Thu, 7 Jun 2018 11:32:33 -0700
Message-ID: <5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com> (raw)
In-Reply-To: <CAFj8pRAeXRoomwTJYvKfsNbre_H+GUbrhq2z4AsSTCjDRO=OYA@mail.gmail.com>
References: <2a8ae0b7-1fd4-869a-a25e-d598968898c9@aklaver.com>
	<CAFj8pRAeXRoomwTJYvKfsNbre_H+GUbrhq2z4AsSTCjDRO=OYA@mail.gmail.com>

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




view thread (3+ messages)

Message-ID: <5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com>
Permalink:  ../5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com/
Also on:    postgresql.org/message-id/5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, pavel.stehule@gmail.com
  Subject: Re: json_populate_recordset
  In-Reply-To: <5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com>
  References: <2a8ae0b7-1fd4-869a-a25e-d598968898c9@aklaver.com> <CAFj8pRAeXRoomwTJYvKfsNbre_H+GUbrhq2z4AsSTCjDRO=OYA@mail.gmail.com> <5c23fd93-ef7c-3b76-327c-334b91b1e710@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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