Re: [PATCH] Make select_views regression test output deterministic

From: Bryan Green <dbryan(dot)green(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Make select_views regression test output deterministic
Date: 2026-08-10 15:12:50
Message-ID: 2bcdfb01-4e37-4461-8b70-62d763ee414d@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/9/26 10:04, Tom Lane wrote:
> Bryan Green <dbryan(dot)green(at)gmail(dot)com> writes:
>> select_views runs "SELECT * FROM street" with no ORDER BY, and its iexit
>> query, "SELECT name, #thepath", orders only by name and the point count.
>> Both lean on heap scan order for the rest, so the expected output isn't
>> deterministic and can shift with page layout or scan order.
>> The fix gives each query a total ordering (COLLATE "C" so it's
>> locale-independent).  Since the ordering covers every output column, rows a
>> scan could reorder are identical in the output anyway, so the result is
>> stable.
>
> I'm disinclined to accept this patch. You've shown no actual evidence
> of output instability, and we have decades of experience showing the
> contrary.
>
> I'm not unsympathetic to the idea that this test could be a headache
> for someone trying to run the regression tests atop a different table
> AM --- but if we were trying to make the tests safe for scenarios
> like that, there are hundreds of other places that would have to
> change too. And the implications of doing that are not great.
> As the manual explains:
>
> 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.
>
> I suspect that in a fair number of places, we'd actually find
> ourselves breaking the intent of the test case because it would
> now not exercise the plan shape it was made to test. So moving
> the goalposts meaningfully in this respect, while preserving
> test coverage, seems like a pretty deep research project.
> But short of that, I don't see much point in one-off fixes.
>
> regards, tom lane
Tom,

Agreed, and thanks for spelling out the coverage rationale. It does seem
like an interesting deep research project, but I won't be adding this to
the commitfest.

--
Bryan Green
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bryan Green 2026-08-10 15:32:05 Re: [PATCH] Fix TOCTOU races in recovery/t/020_archive_status.pl archive checks
Previous Message Tom Lane 2026-08-10 15:11:27 Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.