pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove dynamic translation of regression test scripts, step 1.
Date: Mon, 20 Dec 2021 19:16:06 +0000
Message-ID: <E1mzO8k-0000Yz-0R@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1mzO8k-0000Yz-0R@gemulon.postgresql.org>
Permalink:  ../E1mzO8k-0000Yz-0R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mzO8k-0000Yz-0R@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove dynamic translation of regression test scripts, step 1.
  In-Reply-To: <E1mzO8k-0000Yz-0R@gemulon.postgresql.org>
  References: <E1mzO8k-0000Yz-0R@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox