agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: KES <kes-kes@yandex.ru>
To: David G. Johnston <david.g.johnston@gmail.com>
To: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Add example to sort results by two composite types
Date: Fri, 18 Jul 2025 12:22:27 +0300
Message-ID: <221161752830249@mail.yandex.ru> (raw)
In-Reply-To: <CAKFQuwYasSoJjBJShcomQ76ZYEOt-UqrpTja=J7Emi5aZcgjKA@mail.gmail.com>
References: <175241302040.858619.13742825859329909914@wrigleys.postgresql.org>
	<CAKFQuwYasSoJjBJShcomQ76ZYEOt-UqrpTja=J7Emi5aZcgjKA@mail.gmail.com>

<div>I never saw such examples before and never thought that I can pass two composite types into ORDER BY clause. Because this section is about composite types, I found it could be useful to highlight that possibility. Otherwise it is too implicit. at least for not so experienced users like me.</div><div> </div><div> </div><div><br /></div><div><br /></div><div>----------------</div>
                        <div>Кому: kes-kes@yandex.ru (kes-kes@yandex.ru), pgsql-docs@lists.postgresql.org (pgsql-docs@lists.postgresql.org);<br /></div>
                        
                        <div>Тема: Add example to sort results by two composite types;<br /></div>
                        <div>14.07.2025, 16:58, "David G. Johnston" &lt;david.g.johnston@gmail.com&gt;:<br /></div>
                        <blockquote>On Sunday, July 13, 2025, PG Doc comments form &lt;<a href="mailto:noreply@postgresql.org">noreply@postgresql.org</a>&gt; wrote:<br /><blockquote class="f13ca48719c8a60033905b23b39675agmail_quote" style="border-left-color:#ccc;border-left-style:solid;border-left-width:1px;margin:0 0 0 0.8ex;padding-left:1ex"><br />
I suggest to extend the example to sort results by first composite type and<br />
then by the second:<br />
SELECT * FROM invertory_type t, inventory_item c ORDER BY (<a href="http://c.name/"; target="_blank">c.name</a>,<br />
c.supplier_id, c.price), (<a href="http://t.name/"; target="_blank">t.name</a>, t.value);<br />
<br />
Though I did not checked this if it possible or not. It would be nice to<br />
have it documented.<br />
</blockquote><div><br /></div><div>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.</div><div><br /></div><div>David J.</div><div><br /></div>
</blockquote>





view thread (3+ messages)

Message-ID: <221161752830249@mail.yandex.ru>
Permalink:  ../221161752830249@mail.yandex.ru/
Also on:    postgresql.org/message-id/221161752830249@mail.yandex.ru

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: kes-kes@yandex.ru, david.g.johnston@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Add example to sort results by two composite types
  In-Reply-To: <221161752830249@mail.yandex.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox