Re: Add example to sort results by two composite types

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "kes-kes(at)yandex(dot)ru" <kes-kes(at)yandex(dot)ru>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Add example to sort results by two composite types
Date: 2025-07-14 13:57:57
Message-ID: CAKFQuwYasSoJjBJShcomQ76ZYEOt-UqrpTja=J7Emi5aZcgjKA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sunday, July 13, 2025, PG Doc comments form <noreply(at)postgresql(dot)org>
wrote:

>
> I suggest to extend the example to sort results by first composite type and
> then by the second:
> SELECT * FROM invertory_type t, inventory_item c ORDER BY (c.name,
> c.supplier_id, c.price), (t.name, t.value);
>
> Though I did not checked this if it possible or not. It would be nice to
> have it documented.
>

What new information does that add or uncertainty does it clarify? This
isn’t a section teaching order by - the reader is expected to already
understand that an order by clause can accept two column names and how
those are treated (i.e., ties among the first are broken by the second).
This is a section about how within that structure the comparisons happen.
A single column suffices to make that explanation.

David J.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2025-07-14 15:17:34 Re: please define 'statement' in the glossary
Previous Message P M 2025-07-14 10:10:21 Re: please define 'statement' in the glossary