Re: Clarify the ordering guarantees in combining queries (or lack thereof) - Mailing list pgsql-docs

From David G. Johnston
Subject Re: Clarify the ordering guarantees in combining queries (or lack thereof)
Date
Msg-id CAKFQuwZLpXqOs5JhtyLkEhv6Y6TAUK-aJuMOG9v1-zatgrZq5Q@mail.gmail.com
Whole thread Raw
In response to Clarify the ordering guarantees in combining queries (or lack thereof)  (Shay Rojansky <roji@roji.org>)
Responses Re: Clarify the ordering guarantees in combining queries (or lack thereof)  (Shay Rojansky <roji@roji.org>)
List pgsql-docs
On Wed, Jul 13, 2022 at 5:08 PM Shay Rojansky <roji@roji.org> wrote:
Greetings.

I was trying to understand what - if any - are the guarantees with regards to ordering for combining queries (UNION/UNION ALL/...). From this message[1], it seems that UNION ALL does preserve the ordering of the operand queries, whereas UNION does not (presumably neither do INTERSECT, INTERSECT ALL, EXCEPT and EXCEPT ALL).

The documentation[2] makes no mention of this, I'd suggest adding a note clarifying this.


Since the documentation doesn't make a guarantee there is none.  If you want ordered output use ORDER BY.

David J.

pgsql-docs by date:

Previous
From: Shay Rojansky
Date:
Subject: Clarify the ordering guarantees in combining queries (or lack thereof)
Next
From: "ideriha.takeshi@fujitsu.com"
Date:
Subject: RE: No documentation exists about ecpg ORACLE comptaible mode