diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 60250bb7a9f..327c3d04f7b 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -285,7 +285,10 @@ gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
file against the reference outputs stored in the
src/test/regress/expected directory. Any
differences are saved for your inspection in
- src/test/regress/regression.diffs. (Or you
+ src/test/regress/regression.diffs. If you don't
+ like the diff options that are used by default, set the
+ environment variable PG_REGRESS_DIFF_OPTS, for
+ instance PG_REGRESS_DIFF_OPTS='-u'. (Or you
can run diff yourself, if you prefer.)
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 1980fd63957..b632326e08d 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1970,6 +1970,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
*/
ifunc();
+ if (getenv("PG_REGRESS_DIFF_OPTS"))
+ pretty_diff_opts = getenv("PG_REGRESS_DIFF_OPTS");
+
while ((c = getopt_long(argc, argv, "hV", long_options, &option_index)) != -1)
{
switch (c)