Clarify note about DISTINCT and ORDER BY in aggregates

2022-12-08 Thread Vik Fearing
The current docs can be read as using DISTINCT in an aggregate 
(count(distinct col)) and ORDER BY (array_agg(col ORDER BY col)) are 
both extensions to the standard.


The actual truth is that our extension to the standard is to allow both 
at the same time.


Attached is a trivial patch to make that more clear.  I don't know if 
pgindent works on the docs so I made this so as to show what is 
changing.  I can submit a properly formatted patch, or let the eventual 
committer make that change if necessary.

--
Vik Fearingdiff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index 93ad71737f..4aecefae8a 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -1634,6 +1634,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table;  -- incorrect

 
  The ability to specify both DISTINCT and ORDER BY
+ at the same time
  in an aggregate function is a PostgreSQL extension.
 



Re: nextval parameter is not clear

2022-12-08 Thread Laurenz Albe
On Wed, 2022-12-07 at 14:32 -0700, David G. Johnston wrote:
> While I agree with the conclusion that the function signature is an example,
> and having more than one for these is probably overkill, we can address the
> OP's complaint quite easily by doing what we do in many other places, give
> each parameter in the function signature a name.  I've modified v9 to include
> those and attach it here as v10.  I do think this suffices as a response
> to this complaint.
> 
> Bikeshedding on the names for setval, and maybe an attempt to incorporate
> the parameter name into the prose, can be considered, though.

Thanks for looking into that, and parameter names are fully sufficient to
clarify the usage.

Your patch is good, except that you forgot to add the link target on the CREATE
SEQUENCE page.

> My thoughts regarding incorporating pg_get_serial_sequence and usage of these
> functions in a more common, GENERATED AS IDENTITY environment, can be 
> considered
> in a separate thread should I or anyone else wish to do so.

+1

Yours,
Laurenz Albe