Re: [PROPOSAL] : Use of ORDER BY clause in insert.sql - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PROPOSAL] : Use of ORDER BY clause in insert.sql
Date
Msg-id 1142439.1666934007@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PROPOSAL] : Use of ORDER BY clause in insert.sql  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: [PROPOSAL] : Use of ORDER BY clause in insert.sql
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
> On Fri, 28 Oct 2022 at 16:51, Amul Sul <sulamul@gmail.com> wrote:
>> If we
>> are too sure that the output usually comes in the same order then the
>> ORDER BY clause that exists in other tests seems useless. I am a bit
>> confused & what could be a possible bug?

> You can't claim that if this test shouldn't get an ORDER BY that all
> tests shouldn't have an ORDER BY. That's just crazy. What if the test
> is doing something like testing sort?!

The general policy is that we'll add ORDER BY when a test is demonstrated
to have unstable output order for identifiable environmental reasons
(e.g. locale dependency) or timing reasons (e.g. background autovacuum
sometimes changing statistics).  But the key word there is "identifiable".
Without some evidence as to what's causing this, it remains possible
that it's a code bug not the fault of the test case.

regress.sgml explains the policy further:

  You might wonder why we don't order all the regression test queries explicitly
  to get rid of this issue once and for all.  The reason is that that would
  make the regression tests less useful, not more, since they'd tend
  to exercise query plan types that produce ordered results to the
  exclusion of those that don't.

            regards, tom lane



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [PROPOSAL] : Use of ORDER BY clause in insert.sql
Next
From: David Rowley
Date:
Subject: Re: Adding doubly linked list type which stores the number of items in the list