Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6OCt-0006Xv-HI for pgsql-docs@arkaria.postgresql.org; Fri, 14 Aug 2020 01:08:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k6OCs-0006Cz-GA for pgsql-docs@arkaria.postgresql.org; Fri, 14 Aug 2020 01:08:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6NnP-0004Tk-9I for pgsql-docs@lists.postgresql.org; Fri, 14 Aug 2020 00:42:11 +0000 Received: from 102c.relay.hey.com ([204.62.115.201]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6NnL-0004Fs-WB for pgsql-docs@lists.postgresql.org; Fri, 14 Aug 2020 00:42:10 +0000 Received: from hey.com (bigip-vip.rw-ash-int.37signals.com [10.20.0.17]) by 102.relay.hey.com (Postfix) with ESMTP id 7790F820B1; Fri, 14 Aug 2020 00:42:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 102.relay.hey.com 7790F820B1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hey.com; s=heymail; t=1597365726; bh=pMmwo4r5gzqHVKmSYhJ+4B31E/0zhpQVD/cUZXRdhkY=; h=Date:From:To:In-Reply-To:Subject; b=fXMn6dZn1dBYshGOWpLE0AK+I6TfvNKnn9PVS7NP8XzKx6bs5rZqCSAVss4CuBvfU PLYCC+zEP45BT4CAE5ZmylZ240wVFXJfJWberC14tNGNWHGSw6Yf5W5l1bxLW7x3aZ gD2VLvURL2T5KdektC18XQ7H40yT8TKQ0doj9ibK1bFKi7or6izBjaLd9GUb67o7ow OGBZJgkEdC3i7IvC7poE8qHSb+LVwHDA+MvjRgVESsKaReIE40cskH8mj7Wb1tGHVy bYVt2Ye26usNPbu0ioLFKtHbo/ZfrKZvV8trdE60UBK9vkCPd030uYdoNbxqE65u7g j+y1x+KL7GoBA== Date: Fri, 14 Aug 2020 00:42:06 +0000 From: Jonathan Allard To: Jonathan , "pgsql-docs@lists.postgresql.org" , "David G. Johnston" Message-ID: <21052f1ca6a73db0959d4f5fac8f824439aef73a@hey.com> In-Reply-To: Subject: Re: json_populate_record Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5f35ddde607bb_3c2d2d505434"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ----==_mimepart_5f35ddde607bb_3c2d2d505434 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you for those helpful observations.=0D =E2=80=9CThe example seems sufficiently illustrative though.=E2=80=9D=0D =0D =0D I'm not sure what other readers have experienced, but I can say I definit= ely tried to understand the example, and I wasn't able to piece together = what it means. Namely, I had no idea what `null::myrowtype` was supposed = to mean. (Not to mention that I wasn't familiar with composite types at a= ll)=0D =E2=80=9COne normally does this by casting SQL null to the desired compos= ite type; usually one associated with an existing table.=E2=80=9D=0D =0D =0D I literally learned this while reading your reply! It would have been rea= lly helpful for that to be included in the docs.=0D =0D One side note: The "Note" layout to expand on functions seems suboptimal = to me. It is not easy to discern among the notes which belongs to which. = It would probably be helpful to have better fledged sections under the fo= rm (function_name =3D> more notes).=0D =0D "David G. Johnston" wrote:=0D =E2=80=9COn Thursday, August 13, 2020, PG Doc comments form wrote:=0D =E2=80=9CThe following documentation comment has been logged on the websi= te:=0D =0D =0D Page: https://www.postgresql.org/docs/12/functions-json.html=0D =0D Description:=0D =0D =0D It is not clear what the parameter `base` means=E2=80=9D=0D =0D =0D =0D I agree there is room for improvement here.=C2=A0 The referenced note doe= s=E2=80=99t use the term =E2=80=9Cbase=E2=80=9D which making finding the = correct note among the various possibilities more difficult.=C2=A0 The ex= ample seems sufficiently illustrative though.=C2=A0 Those functions conve= rt json to SQL composite types.=C2=A0 You need to pass in which composite= type to convert to.=C2=A0 That is the =E2=80=9Cbase=E2=80=9D type.=C2=A0= One normally does this by casting SQL null to the desired composite type= ; usually one associated with an existing table.=0D =0D David J.=E2=80=9D=0D ----==_mimepart_5f35ddde607bb_3c2d2d505434 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =0D =0D =0D =0D =0D =0D =0D =0D =0D =0D
=0D
=0D
Thank you for those helpful observations.

The example seems sufficiently illustrative though.
I'm not sure what other readers have experienced, but I can say I defini= tely tried to understand the example, and I wasn't able to piece together= what it means. Namely, I had no idea what `null::myrowtype` was supposed= to mean. (Not to mention that I wasn't familiar with composite types at = all)

One normally does this by casting SQL null = to the desired composite type; usually one associated with an existing ta= ble.

I literally learned this while reading your rep= ly! It would have been really helpful for that to be included in the docs= .

One side note: The "Note" layout to expand on function= s seems suboptimal to me. It is not easy to discern among the notes which= belongs to which. It would probably be helpful to have better fledged se= ctions under the form (function_name =3D> more notes).

<= br>
"David G. Johnston" <david.g.johnston@gmai= l.com> wrote:
On Thursday, August 13, 2020, PG Doc co= mments form <noreply@postgre= sql.org> wrote:
The following = documentation comment has been logged on the website:
=0D
=0D Page: = https://www.postgresql.org/docs/12/functions-json.html
=0D Description:
=0D
=0D It is not clear what the parameter `base` means
=0D


I agree there is room for improvement here.=C2=A0 Th= e referenced note does=E2=80=99t use the term =E2=80=9Cbase=E2=80=9D whic= h making finding the correct note among the various possibilities more di= fficult.=C2=A0 The example seems sufficiently illustrative though.=C2=A0 = Those functions convert json to SQL composite types.=C2=A0 You need to pa= ss in which composite type to convert to.=C2=A0 That is the =E2=80=9Cbase= =E2=80=9D type.=C2=A0 One normally does this by casting SQL null to the d= esired composite type; usually one associated with an existing table.
=
David J.

=0D
=0D =0D
=0D =0D =0D ----==_mimepart_5f35ddde607bb_3c2d2d505434--