Re: Document aggregate functions better w.r.t. ORDER BY

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Document aggregate functions better w.r.t. ORDER BY
Дата
Msg-id ZTrp6XhK0dFOC6Zz@momjian.us
обсуждение исходный текст
Ответ на Re: Document aggregate functions better w.r.t. ORDER BY  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Document aggregate functions better w.r.t. ORDER BY  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On Thu, Oct 26, 2023 at 03:09:26PM -0700, David G. Johnston wrote:
> On Thu, Oct 26, 2023 at 2:56 PM Bruce Momjian <bruce@momjian.us> wrote:
> 
>     On Wed, Oct 25, 2023 at 10:34:10PM -0700, David G. Johnston wrote:
>     > I would reword the existing note to be something like:
>     >
>     > The SQL Standard defines specific aggregates and their properties,
>     including
>     > which of DISTINCT and/or ORDER BY is allowed.  Due to the extensible
>     nature of
>     > PostgreSQL it accepts either or both clauses for any aggregate.
> 
>     Uh, is this something in my patch or somewhere else?  I don't think
>     PostgreSQL extensible is an example of syntax flexibility.
> 
> 
> https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES
> 
> Note
> The ability to specify both DISTINCT and ORDER BY in an aggregate function is a
> PostgreSQL extension.
> 
> I am pointing out that the first sentence of the existing note above seems to
> be factually incorrect.  I tried to make it correct - while explaining why we
> differ.  Though in truth I'd probably rather just remove the note.

Agreed, removed, patch attached.  This is just too complex to specify.

>     > We get enough complaints regarding "apparent ordering" that I would like
>     to
>     > add:
>     >
>     > As a reminder, while some DISTINCT processing algorithms produce sorted
>     output
>     > as a side-effect, only by specifying ORDER BY is the output order
>     guaranteed.
> 
>     Well, we need to create a new email thread for this and look at all the
>     areas is applies to since this is a much larger issue.
> 
> I was hoping to sneak this one in regardless of the bigger picture issues,
> since this specific combination is guaranteed to output ordered presently.

No sneaking.  ;-)  It would be bad to document this unevenly because it
sets expectations in other parts of the system if we don't mention it.

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

  Only you can decide what is important to you.

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Improve WALRead() to suck data directly from WAL buffers when possible
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Document aggregate functions better w.r.t. ORDER BY