pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JSON/JSONB documentation, aggregate functions
3+ messages / 2 participants
[nested] [flat]

* JSON/JSONB documentation, aggregate functions
@ 2022-09-16 20:08 PG Doc comments form <noreply@postgresql.org>
  2022-10-11 15:48 ` Re: JSON/JSONB documentation, aggregate functions Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2022-09-16 20:08 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: alex.denman@nih.gov

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/functions-json.html
Description:

Regarding the Json documentation (9.16.1: processing and creating JSON
data), I would like to suggest that the reference to
json_agg/jsonb_agg/json_object_agg/jsonb_object_agg (section 9.21) be made
more prominent. When looking through the list of json[b] processing
functions, it's really easy to miss the footnote mentioning the aggregate
functions. The list of functions in table 9.47 includes a lot of functions
that are *really*similar in purpose to the json aggregator functions, and
it's easy to assume that anything related to building JSON[B] objects *must*
be listed there. I just spent hours searching for a way to turn one column
of keys and one column of values into a JSONB object (without coercing all
numeric values to json strings), and I can't imagine I'm the only one.

Regards,
Alex Denman


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

* Re: JSON/JSONB documentation, aggregate functions
  2022-09-16 20:08 JSON/JSONB documentation, aggregate functions PG Doc comments form <noreply@postgresql.org>
@ 2022-10-11 15:48 ` Bruce Momjian <bruce@momjian.us>
  2022-10-17 19:21   ` Re: JSON/JSONB documentation, aggregate functions Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2022-10-11 15:48 UTC (permalink / raw)
  To: alex.denman@nih.gov; pgsql-docs@lists.postgresql.org

On Fri, Sep 16, 2022 at 08:08:04PM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/14/functions-json.html
> Description:
> 
> Regarding the Json documentation (9.16.1: processing and creating JSON
> data), I would like to suggest that the reference to
> json_agg/jsonb_agg/json_object_agg/jsonb_object_agg (section 9.21) be made
> more prominent. When looking through the list of json[b] processing
> functions, it's really easy to miss the footnote mentioning the aggregate
> functions. The list of functions in table 9.47 includes a lot of functions
> that are *really*similar in purpose to the json aggregator functions, and
> it's easy to assume that anything related to building JSON[B] objects *must*
> be listed there. I just spent hours searching for a way to turn one column
> of keys and one column of values into a JSONB object (without coercing all
> numeric values to json strings), and I can't imagine I'm the only one.

I see your point --- that the aggregate sentence is at the end of the
section, after four massive tables.  The attached patch moves the
paragraph up to the end of the section's introductory paragraph.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson

Attachments:

  [text/x-diff] agg.diff (1.4K, ../../Y0WQRd%2FW94CuevdX@momjian.us/2-agg.diff)
  download | inline diff:
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index b2bdbc7d1c..8dd543a2c1 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15149,6 +15149,12 @@ table2-mapping
    <type>jsonb</type>, though not for <type>json</type>.  The comparison
    operators follow the ordering rules for B-tree operations outlined in
    <xref linkend="json-indexing"/>.
+   See also <xref linkend="functions-aggregate"/> for the aggregate
+   function <function>json_agg</function> which aggregates record
+   values as JSON, the aggregate function
+   <function>json_object_agg</function> which aggregates pairs of values
+   into a JSON object, and their <type>jsonb</type> equivalents,
+   <function>jsonb_agg</function> and <function>jsonb_object_agg</function>.
   </para>
 
   <table id="functions-json-op-table">
@@ -16604,15 +16610,6 @@ table2-mapping
      </tbody>
     </tgroup>
    </table>
-
-  <para>
-    See also <xref linkend="functions-aggregate"/> for the aggregate
-    function <function>json_agg</function> which aggregates record
-    values as JSON, the aggregate function
-    <function>json_object_agg</function> which aggregates pairs of values
-    into a JSON object, and their <type>jsonb</type> equivalents,
-    <function>jsonb_agg</function> and <function>jsonb_object_agg</function>.
-  </para>
  </sect2>
 
  <sect2 id="functions-sqljson-path">

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

* Re: JSON/JSONB documentation, aggregate functions
  2022-09-16 20:08 JSON/JSONB documentation, aggregate functions PG Doc comments form <noreply@postgresql.org>
  2022-10-11 15:48 ` Re: JSON/JSONB documentation, aggregate functions Bruce Momjian <bruce@momjian.us>
@ 2022-10-17 19:21   ` Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2022-10-17 19:21 UTC (permalink / raw)
  To: alex.denman@nih.gov; pgsql-docs@lists.postgresql.org

On Tue, Oct 11, 2022 at 11:48:21AM -0400, Bruce Momjian wrote:
> On Fri, Sep 16, 2022 at 08:08:04PM +0000, PG Doc comments form wrote:
> > Regarding the Json documentation (9.16.1: processing and creating JSON
> > data), I would like to suggest that the reference to
> > json_agg/jsonb_agg/json_object_agg/jsonb_object_agg (section 9.21) be made
> > more prominent. When looking through the list of json[b] processing
> > functions, it's really easy to miss the footnote mentioning the aggregate
> > functions. The list of functions in table 9.47 includes a lot of functions
> > that are *really*similar in purpose to the json aggregator functions, and
> > it's easy to assume that anything related to building JSON[B] objects *must*
> > be listed there. I just spent hours searching for a way to turn one column
> > of keys and one column of values into a JSONB object (without coercing all
> > numeric values to json strings), and I can't imagine I'm the only one.
> 
> I see your point --- that the aggregate sentence is at the end of the
> section, after four massive tables.  The attached patch moves the
> paragraph up to the end of the section's introductory paragraph.

Patch applied back to PG 10, thanks.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson






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


end of thread, other threads:[~2022-10-17 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 20:08 JSON/JSONB documentation, aggregate functions PG Doc comments form <noreply@postgresql.org>
2022-10-11 15:48 ` Bruce Momjian <bruce@momjian.us>
2022-10-17 19:21   ` Bruce Momjian <bruce@momjian.us>

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