It occurred to me after having to change I think 9 files to clean up a small mess in the jsonb regression tests the other day that we might usefully expose the inputdir and outputdir to psql as variables when running pg_regress. Then we might be able to do thing like this, quite independent of location:

   \set datafile :inputdir/data/mystuff.data
   COPY mytable FROM :'datafile';

The actual location would not need to appear in the SQL (and thus not in the results file either).

A small patch that tries to do that is attached.

Thoughts?

cheers

andrew
diff --git a/src/test/regress/pg_regress_main.c b/src/test/regress/pg_regress_main.c
index a4f66b8..d47915b 100644
--- a/src/test/regress/pg_regress_main.c
+++ b/src/test/regress/pg_regress_main.c
@@ -64,9 +64,11 @@ psql_start_test(const char *testname,
 						   "%s ", launcher);
 
 	snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset,
-			 SYSTEMQUOTE "\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
+			 SYSTEMQUOTE "\"%s%spsql\" -X -a -q -v \"inputdir=%s\" -v \"outputdir=%s\" -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
 			 psqldir ? psqldir : "",
 			 psqldir ? "/" : "",
+			 inputdir,
+			 outputdir,
 			 dblist->str,
 			 infile,
 			 outfile);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to