pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
json_populate_record
5+ messages / 4 participants
[nested] [flat]

* json_populate_record
@ 2020-08-13 22:17 PG Doc comments form <noreply@postgresql.org>
  2020-08-13 23:08 ` Re: json_populate_record David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: PG Doc comments form @ 2020-08-13 22:17 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: jonathan@allard.io

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: json_populate_record
  2020-08-13 22:17 json_populate_record PG Doc comments form <noreply@postgresql.org>
@ 2020-08-13 23:08 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-08-14 00:39   ` Re: json_populate_record Tom Lane <tgl@sss.pgh.pa.us>
  2020-08-14 00:42   ` Re: json_populate_record Jonathan Allard <jonathan.allard@hey.com>
  0 siblings, 2 replies; 5+ messages in thread

From: David G. Johnston @ 2020-08-13 23:08 UTC (permalink / raw)
  To: jonathan@allard.io <jonathan@allard.io>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: json_populate_record
  2020-08-13 22:17 json_populate_record PG Doc comments form <noreply@postgresql.org>
  2020-08-13 23:08 ` Re: json_populate_record David G. Johnston <david.g.johnston@gmail.com>
@ 2020-08-14 00:39   ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2020-08-14 00:39 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: jonathan@allard.io <jonathan@allard.io>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, August 13, 2020, PG Doc comments form <noreply@postgresql.org>
> wrote:
>> 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.

Yeah, that used to be pretty unreadable.  I think the reformatting of
these tables that I did for v13 helps a lot, though:

https://www.postgresql.org/docs/devel/functions-json.html

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: json_populate_record
  2020-08-13 22:17 json_populate_record PG Doc comments form <noreply@postgresql.org>
  2020-08-13 23:08 ` Re: json_populate_record David G. Johnston <david.g.johnston@gmail.com>
@ 2020-08-14 00:42   ` Jonathan Allard <jonathan.allard@hey.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Jonathan Allard @ 2020-08-14 00:42 UTC (permalink / raw)
  To: Jonathan <jonathan@allard.io>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>; David G. Johnston <david.g.johnston@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.”

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2020-08-14 00:42 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 22:17 json_populate_record PG Doc comments form <noreply@postgresql.org>
2020-08-13 23:08 ` David G. Johnston <david.g.johnston@gmail.com>
2020-08-14 00:39   ` Tom Lane <tgl@sss.pgh.pa.us>
2020-08-14 00:42   ` Jonathan Allard <jonathan.allard@hey.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