From: Jonathan Allard <jonathan.allard@hey.com>
To: Jonathan <jonathan@allard.io>
To: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
To: David G. Johnston <david.g.johnston@gmail.com>
Subject: Re: json_populate_record
Date: Fri, 14 Aug 2020 00:42:06 +0000
Message-ID: <21052f1ca6a73db0959d4f5fac8f824439aef73a@hey.com> (raw)
In-Reply-To: <CAKFQuwbx6vZAh7zZOmW5ZGVbnWutkLHedns3tdwho9KUiJdOCA@mail.gmail.com>
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 definitely 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 table.”
I literally learned this while reading your reply! It would have been really helpful for that to be included in the docs.
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 form (function_name => more notes).
"David G. Johnston" <david.g.johnston@gmail.com> wrote:
“On Thursday, August 13, 2020, PG Doc comments form <noreply@postgresql.org> wrote:
“The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/12/functions-json.html
Description:
It is not clear what the parameter `base` means”
I agree there is room for improvement here. The referenced note does’t use the term “base” which making finding the correct note among the various possibilities more difficult. The example seems sufficiently illustrative though. Those functions convert json to SQL composite types. You need to pass in which composite type to convert to. That is the “base” type. One normally does this by casting SQL null to the desired composite type; usually one associated with an existing table.
David J.”
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 using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: jonathan.allard@hey.com, jonathan@allard.io, pgsql-docs@lists.postgresql.org, david.g.johnston@gmail.com
Subject: Re: json_populate_record
In-Reply-To: <21052f1ca6a73db0959d4f5fac8f824439aef73a@hey.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