pgsql: Remove dynamic translation of regression test scripts, step 1. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove dynamic translation of regression test scripts, step 1.
Date
Msg-id E1mzO8k-0000Yz-0R@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove dynamic translation of regression test scripts, step 1.

pg_regress has long had provisions for dynamically substituting path
names into regression test scripts and result files, but use of that
feature has always been a serious pain in the neck, mainly because
updating the result files requires tedious manual editing.  Let's
get rid of that in favor of passing down the paths in environment
variables.

In addition to being easier to maintain, this way is capable of
dealing with path names that require escaping at runtime, for example
paths containing single-quote marks.  (There are other stumbling
blocks in the way of actually building in a path that looks like
that, but removing this one seems like a good thing to do.)  The key
coding rule that makes that possible is to concatenate pieces of a
dynamically-variable string using psql's \set command, and then use
the :'variable' notation to quote and escape the string for the next
level of interpretation.

In hopes of making this change more transparent to "git blame",
I've split it into two steps.  This commit adds the necessary
pg_regress.c support and changes all the *.source files in-place
so that they no longer require any dynamic translation.  The next
commit will just "git mv" them into the regular sql/ and expected/
directories.

Discussion: https://postgr.es/m/1655733.1639871614@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d1029bb5a26cb84b116b0dee4dde312291359f2a

Modified Files
--------------
contrib/dblink/input/paths.source                | 15 +++-
contrib/dblink/output/paths.source               | 13 +++-
contrib/file_fdw/input/file_fdw.source           | 53 ++++++++++---
contrib/file_fdw/output/file_fdw.source          | 55 ++++++++++----
src/pl/plpgsql/src/input/plpgsql_copy.source     | 46 ++++++------
src/pl/plpgsql/src/output/plpgsql_copy.source    | 43 +++++------
src/test/regress/input/constraints.source        |  9 ++-
src/test/regress/input/copy.source               | 96 +++++++++++++++---------
src/test/regress/input/create_function_0.source  | 41 ++++++----
src/test/regress/input/create_function_1.source  | 14 +++-
src/test/regress/input/create_function_2.source  | 18 +++--
src/test/regress/input/largeobject.source        | 35 +++++----
src/test/regress/input/misc.source               | 16 ++--
src/test/regress/input/tablespace.source         | 11 ++-
src/test/regress/output/constraints.source       |  8 +-
src/test/regress/output/copy.source              | 95 ++++++++++++++---------
src/test/regress/output/create_function_0.source | 46 ++++++++----
src/test/regress/output/create_function_1.source | 12 ++-
src/test/regress/output/create_function_2.source | 14 ++--
src/test/regress/output/largeobject.source       | 34 +++++----
src/test/regress/output/largeobject_1.source     | 34 +++++----
src/test/regress/output/misc.source              | 15 ++--
src/test/regress/output/tablespace.source        |  9 ++-
src/test/regress/pg_regress.c                    |  8 ++
24 files changed, 477 insertions(+), 263 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Add a \getenv command to psql.
Next
From: Tom Lane
Date:
Subject: pgsql: Merge dblink's paths test script into its main test.