Re:BUG #18221: Unexpected Query Result

Sergei Kornilov <sk@zsrv.org>

From: Sergei Kornilov <sk@zsrv.org>
To: PG Bug reporting form <noreply@postgresql.org>
Cc: bajinsheng@u.nus.edu, pgsql-bugs@lists.postgresql.org
Date: 2023-12-03T13:44:09Z
Lists: pgsql-bugs
Hello

Using "distinct on" without specifying an explicit "order by" is unpredictable in itself. I'll quote from the manual:

> Note that the “first row” of each set is unpredictable unless ORDER BY is used to ensure that the desired row appears first.

Can you reproduce the unexpected behavior with explicit order by clause?

regards, Sergei