<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(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);<br /></div>
<div>Тема: Add example to sort results by two composite types;<br /></div>
<div>14.07.2025, 16:58, "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>:<br /></div>
<blockquote>On Sunday, July 13, 2025, PG Doc comments form <<a href="mailto:noreply(at)postgresql(dot)org">noreply(at)postgresql(dot)org</a>> 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>