Re: Reproducing incorrect order with order by in a subquery

Karsten Hilbert <karsten.hilbert@gmx.net>

From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: Ruslan Zakirov <ruslan.zakirov@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Date: 2023-06-15T18:15:46Z
Lists: pgsql-general
Am Thu, Jun 15, 2023 at 12:58:55AM +0300 schrieb Ruslan Zakirov:

e.g.

> https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored/

...

> My goal was to find a small dataset that demonstrates this ordering
> mismatch.

I attempted to think it through whether it is even *possible*
to find a dataset (of any size) which *reliably* demonstrates
the ordering mismatch.

To my understanding -- since the outer query *can* (per
happenstance) return rows in the order of the subquery's
ORDER BY it is not possible to reliably demonstrate that it
won't, is it ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B