Environment variable to disable diffs file output

Ilya Cherdakov <i.cherdakov.pg@gmail.com>

From: Илья Чердаков <i.cherdakov.pg@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: postgres@jeltef.nl
Date: 2026-04-06T07:55:25Z
Lists: pgsql-hackers

Attachments

Greetings!

I'd like to add a environment variable to the patch to
disable diff output. Sometimes you have to be creative
with exploratory testing, modifying test files, etc.,
and multiple diff outputs can become a nuisance. This
doesn't change the default behavior, but it does give
you control over diff output in tests for specific
scenarios where a large number of failures are expected
(mass runs or exploratory testing with changing tests).

The env usage and implementation are somewhat similar
to PG_REGRESS_DIFF_OPTS
     PG_REGRESS_DISABLE_DIFFS_OUTPUT=1 make check -s.

For now, I suggest to simply disabling it, but I'm also
considering passing the number of lines to output via env
or via flag pg_regress instead of completely disabling it.
Something like
     PG_REGRESS_DIFFS_NUMBER_LINES_OUTPUT=20 make check
and then when an error occurs, 20 lines will be output
instead of the default 80. Setting it to 0 disables
diffs output.


I think this small addition will be useful for many
developers, especially testers.
---
This is my first patch. I welcome critique and comments.
Best regards,
Ilya Cherdakov, PostgresPro