[Fwd: Re: [HACKERS] alternate regression dbs?] - Mailing list pgsql-patches

From Andrew Dunstan
Subject [Fwd: Re: [HACKERS] alternate regression dbs?]
Date
Msg-id 4286B532.6020706@dunslane.net
Whole thread Raw
List pgsql-patches
Darn ... previously sent to wrong list

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>
>
>>Currently the pg_regress script does "dbname=regression" and then does
>>everything in terms of $dbname.  Would there be any value in providing a
>>--dbname=foo parameter so that different regression sets could use their
>>own db? One virtue at least might be that we would not drop the core
>>regression db all the time - having it around can be useful, I think.
>>
>>
>
>I'd be in favor of using three such DBs, one for core, PLs, and contrib.
>(More than that seems like it would clutter the disk a lot.)  But I do
>use the standard regression DB as a handy testbed for a lot of stuff,
>and it has bothered me in the past that the contrib installcheck wipes
>it out.
>
>
>
>

Try attached ... season to taste. The bulk of it is changes for dblink
which has the dbname hardcoded.

There is probably more to be done with the regression stuff, but this
and the earlier change give us the low hanging fruit at least, I think.

cheers

andrew


Index: contrib/contrib-global.mk
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/contrib-global.mk,v
retrieving revision 1.8
diff -c -r1.8 contrib-global.mk
*** contrib/contrib-global.mk    30 Jul 2004 12:26:39 -0000    1.8
--- contrib/contrib-global.mk    15 May 2005 02:02:50 -0000
***************
*** 1,4 ****
--- 1,5 ----
  # $PostgreSQL: pgsql/contrib/contrib-global.mk,v 1.8 2004/07/30 12:26:39 petere Exp $

  NO_PGXS = 1
+ TEST_DB = $(CONTRIB_TESTDB)
  include $(top_srcdir)/src/makefiles/pgxs.mk
Index: contrib/dblink/expected/dblink.out
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/dblink/expected/dblink.out,v
retrieving revision 1.13
diff -c -r1.13 dblink.out
*** contrib/dblink/expected/dblink.out    7 Mar 2004 02:27:00 -0000    1.13
--- contrib/dblink/expected/dblink.out    15 May 2005 02:02:51 -0000
***************
*** 98,104 ****

  -- regular old dblink
  SELECT *
! FROM dblink('dbname=regression','SELECT * FROM foo') AS t(a int, b text, c text[])
  WHERE t.a > 7;
   a | b |     c
  ---+---+------------
--- 98,104 ----

  -- regular old dblink
  SELECT *
! FROM dblink('dbname=contrib_regression','SELECT * FROM foo') AS t(a int, b text, c text[])
  WHERE t.a > 7;
   a | b |     c
  ---+---+------------
***************
*** 112,118 ****
  WHERE t.a > 7;
  ERROR:  connection not available
  -- create a persistent connection
! SELECT dblink_connect('dbname=regression');
   dblink_connect
  ----------------
   OK
--- 112,118 ----
  WHERE t.a > 7;
  ERROR:  connection not available
  -- create a persistent connection
! SELECT dblink_connect('dbname=contrib_regression');
   dblink_connect
  ----------------
   OK
***************
*** 260,273 ****
  ERROR:  connection not available
  -- put more data into our slave table, first using arbitrary connection syntax
  -- but truncate the actual return value so we can use diff to check for success
! SELECT substr(dblink_exec('dbname=regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
   substr
  --------
   INSERT
  (1 row)

  -- create a persistent connection
! SELECT dblink_connect('dbname=regression');
   dblink_connect
  ----------------
   OK
--- 260,273 ----
  ERROR:  connection not available
  -- put more data into our slave table, first using arbitrary connection syntax
  -- but truncate the actual return value so we can use diff to check for success
! SELECT substr(dblink_exec('dbname=contrib_regression','INSERT INTO foo
VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);
   substr
  --------
   INSERT
  (1 row)

  -- create a persistent connection
! SELECT dblink_connect('dbname=contrib_regression');
   dblink_connect
  ----------------
   OK
***************
*** 383,389 ****
  DETAIL:  missing "=" after "myconn" in connection info string

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=regression');
   dblink_connect
  ----------------
   OK
--- 383,389 ----
  DETAIL:  missing "=" after "myconn" in connection info string

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=contrib_regression');
   dblink_connect
  ----------------
   OK
***************
*** 420,429 ****

  -- create a second named persistent connection
  -- should error with "duplicate connection name"
! SELECT dblink_connect('myconn','dbname=regression');
  ERROR:  duplicate connection name
  -- create a second named persistent connection with a new name
! SELECT dblink_connect('myconn2','dbname=regression');
   dblink_connect
  ----------------
   OK
--- 420,429 ----

  -- create a second named persistent connection
  -- should error with "duplicate connection name"
! SELECT dblink_connect('myconn','dbname=contrib_regression');
  ERROR:  duplicate connection name
  -- create a second named persistent connection with a new name
! SELECT dblink_connect('myconn2','dbname=contrib_regression');
   dblink_connect
  ----------------
   OK
***************
*** 540,546 ****
  DETAIL:  missing "=" after "myconn" in connection info string

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=regression');
   dblink_connect
  ----------------
   OK
--- 540,546 ----
  DETAIL:  missing "=" after "myconn" in connection info string

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=contrib_regression');
   dblink_connect
  ----------------
   OK
Index: contrib/dblink/sql/dblink.sql
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/dblink/sql/dblink.sql,v
retrieving revision 1.12
diff -c -r1.12 dblink.sql
*** contrib/dblink/sql/dblink.sql    7 Mar 2004 02:27:00 -0000    1.12
--- contrib/dblink/sql/dblink.sql    15 May 2005 02:02:51 -0000
***************
*** 65,71 ****

  -- regular old dblink
  SELECT *
! FROM dblink('dbname=regression','SELECT * FROM foo') AS t(a int, b text, c text[])
  WHERE t.a > 7;

  -- should generate "connection not available" error
--- 65,71 ----

  -- regular old dblink
  SELECT *
! FROM dblink('dbname=contrib_regression','SELECT * FROM foo') AS t(a int, b text, c text[])
  WHERE t.a > 7;

  -- should generate "connection not available" error
***************
*** 74,80 ****
  WHERE t.a > 7;

  -- create a persistent connection
! SELECT dblink_connect('dbname=regression');

  -- use the persistent connection
  SELECT *
--- 74,80 ----
  WHERE t.a > 7;

  -- create a persistent connection
! SELECT dblink_connect('dbname=contrib_regression');

  -- use the persistent connection
  SELECT *
***************
*** 138,147 ****

  -- put more data into our slave table, first using arbitrary connection syntax
  -- but truncate the actual return value so we can use diff to check for success
! SELECT substr(dblink_exec('dbname=regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);

  -- create a persistent connection
! SELECT dblink_connect('dbname=regression');

  -- put more data into our slave table, using persistent connection syntax
  -- but truncate the actual return value so we can use diff to check for success
--- 138,147 ----

  -- put more data into our slave table, first using arbitrary connection syntax
  -- but truncate the actual return value so we can use diff to check for success
! SELECT substr(dblink_exec('dbname=contrib_regression','INSERT INTO foo
VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6);

  -- create a persistent connection
! SELECT dblink_connect('dbname=contrib_regression');

  -- put more data into our slave table, using persistent connection syntax
  -- but truncate the actual return value so we can use diff to check for success
***************
*** 193,199 ****
  WHERE t.a > 7;

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=regression');

  -- use the named persistent connection
  SELECT *
--- 193,199 ----
  WHERE t.a > 7;

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=contrib_regression');

  -- use the named persistent connection
  SELECT *
***************
*** 210,219 ****

  -- create a second named persistent connection
  -- should error with "duplicate connection name"
! SELECT dblink_connect('myconn','dbname=regression');

  -- create a second named persistent connection with a new name
! SELECT dblink_connect('myconn2','dbname=regression');

  -- use the second named persistent connection
  SELECT *
--- 210,219 ----

  -- create a second named persistent connection
  -- should error with "duplicate connection name"
! SELECT dblink_connect('myconn','dbname=contrib_regression');

  -- create a second named persistent connection with a new name
! SELECT dblink_connect('myconn2','dbname=contrib_regression');

  -- use the second named persistent connection
  SELECT *
***************
*** 263,269 ****
  WHERE t.a > 7;

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=regression');

  -- put more data into our slave table, using named persistent connection syntax
  -- but truncate the actual return value so we can use diff to check for success
--- 263,269 ----
  WHERE t.a > 7;

  -- create a named persistent connection
! SELECT dblink_connect('myconn','dbname=contrib_regression');

  -- put more data into our slave table, using named persistent connection syntax
  -- but truncate the actual return value so we can use diff to check for success
Index: src/Makefile.global.in
===================================================================
RCS file: /projects/cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.213
diff -c -r1.213 Makefile.global.in
*** src/Makefile.global.in    25 Mar 2005 23:22:53 -0000    1.213
--- src/Makefile.global.in    15 May 2005 02:02:52 -0000
***************
*** 228,233 ****
--- 228,236 ----
  GZIP    = gzip
  BZIP2    = bzip2

+ PL_TESTDB = --dbname=pl_regression
+ CONTRIB_TESTDB = --dbname=contrib_regression
+
  # Installation.

  INSTALL    = $(SHELL) $(top_srcdir)/config/install-sh -c
Index: src/makefiles/pgxs.mk
===================================================================
RCS file: /projects/cvsroot/pgsql/src/makefiles/pgxs.mk,v
retrieving revision 1.3
diff -c -r1.3 pgxs.mk
*** src/makefiles/pgxs.mk    10 Oct 2004 16:13:03 -0000    1.3
--- src/makefiles/pgxs.mk    15 May 2005 02:02:55 -0000
***************
*** 224,230 ****

  # against installed postmaster
  installcheck: submake
!     $(top_builddir)/src/test/regress/pg_regress $(REGRESS)

  # in-tree test doesn't work yet (no way to install my shared library)
  #check: all submake
--- 224,230 ----

  # against installed postmaster
  installcheck: submake
!     $(top_builddir)/src/test/regress/pg_regress $(TEST_DB) $(REGRESS)

  # in-tree test doesn't work yet (no way to install my shared library)
  #check: all submake
Index: src/pl/plperl/GNUmakefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plperl/GNUmakefile,v
retrieving revision 1.19
diff -c -r1.19 GNUmakefile
*** src/pl/plperl/GNUmakefile    14 May 2005 17:55:20 -0000    1.19
--- src/pl/plperl/GNUmakefile    15 May 2005 02:02:55 -0000
***************
*** 36,42 ****

  SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)

! REGRESS = plperl

  include $(top_srcdir)/src/Makefile.shlib

--- 36,42 ----

  SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)

! REGRESS = $(PL_TESTDB) plperl

  include $(top_srcdir)/src/Makefile.shlib

Index: src/pl/plpython/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/plpython/Makefile,v
retrieving revision 1.19
diff -c -r1.19 Makefile
*** src/pl/plpython/Makefile    14 May 2005 17:55:21 -0000    1.19
--- src/pl/plpython/Makefile    15 May 2005 02:02:55 -0000
***************
*** 58,64 ****

  SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)

! REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop

  include $(top_srcdir)/src/Makefile.shlib

--- 58,64 ----

  SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)

! REGRESS = $(PL_TESTDB) plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop

  include $(top_srcdir)/src/Makefile.shlib

Index: src/pl/tcl/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/pl/tcl/Makefile,v
retrieving revision 1.45
diff -c -r1.45 Makefile
*** src/pl/tcl/Makefile    14 May 2005 17:55:22 -0000    1.45
--- src/pl/tcl/Makefile    15 May 2005 02:02:55 -0000
***************
*** 40,46 ****
  SO_MINOR_VERSION = 0
  OBJS = pltcl.o

! REGRESS = pltcl_setup pltcl_queries

  include $(top_srcdir)/src/Makefile.shlib

--- 40,46 ----
  SO_MINOR_VERSION = 0
  OBJS = pltcl.o

! REGRESS = $(PL_TESTDB) pltcl_setup pltcl_queries

  include $(top_srcdir)/src/Makefile.shlib

Index: src/test/regress/pg_regress.sh
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress.sh,v
retrieving revision 1.54
diff -c -r1.54 pg_regress.sh
*** src/test/regress/pg_regress.sh    11 May 2005 21:52:03 -0000    1.54
--- src/test/regress/pg_regress.sh    15 May 2005 02:02:56 -0000
***************
*** 11,16 ****
--- 11,17 ----
  Usage: $me [options...] [extra tests...]

  Options:
+   --dbname=DB               build database DB (default \`regression')
    --debug                   turn on debug mode in programs that are run
    --inputdir=DIR            take input files from DIR (default \`.')
    --load-language=lang      load the named language before running the
***************
*** 123,128 ****
--- 124,132 ----
          --version)
                  echo "pg_regress (PostgreSQL @VERSION@)"
                  exit 0;;
+         --dbname=*)
+                 dbname=`expr "x$1" : "x--dbname=\(.*\)"`
+                 shift;;
          --debug)
                  debug=yes
                  shift;;


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] pgsql config flag update: apple rendezvous renamed bonjour
Next
From: Bruce Momjian
Date:
Subject: Re: Exec statement logging