From b8f611cf4b119d49dc28b58d610c9d0a5fa5cde7 Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Fri, 12 Jan 2007 10:00:14 +0000
Subject: [PATCH] Simplified regression handling Added patch by Joachim to work
 around OpenBSD bug in regression suite.

---
 src/interfaces/ecpg/ecpglib/connect.c         |  3 +--
 src/interfaces/ecpg/ecpglib/data.c            |  4 +--
 src/interfaces/ecpg/ecpglib/extern.h          |  4 ++-
 src/interfaces/ecpg/ecpglib/misc.c            | 14 ++++++++---
 src/interfaces/ecpg/preproc/ecpg.c            |  6 +++--
 .../test/expected/compat_informix-charfuncs.c |  2 +-
 .../test/expected/compat_informix-dec_test.c  |  2 +-
 .../test/expected/compat_informix-rfmtdate.c  |  2 +-
 .../test/expected/compat_informix-rfmtlong.c  |  2 +-
 .../test/expected/compat_informix-rnull.c     |  2 +-
 .../expected/compat_informix-test_informix.c  |  2 +-
 .../expected/compat_informix-test_informix2.c |  2 +-
 .../ecpg/test/expected/connect-test1.c        |  2 +-
 .../ecpg/test/expected/connect-test2.c        |  2 +-
 .../ecpg/test/expected/connect-test3.c        |  2 +-
 .../ecpg/test/expected/connect-test4.c        |  2 +-
 .../ecpg/test/expected/connect-test5.c        |  2 +-
 .../ecpg/test/expected/pgtypeslib-dt_test.c   |  2 +-
 .../ecpg/test/expected/pgtypeslib-dt_test2.c  |  2 +-
 .../ecpg/test/expected/pgtypeslib-num_test.c  |  2 +-
 .../ecpg/test/expected/pgtypeslib-num_test2.c |  2 +-
 .../ecpg/test/expected/preproc-comment.c      |  2 +-
 .../ecpg/test/expected/preproc-define.c       |  2 +-
 .../ecpg/test/expected/preproc-init.c         |  2 +-
 .../ecpg/test/expected/preproc-type.c         |  2 +-
 .../ecpg/test/expected/preproc-variable.c     |  2 +-
 .../ecpg/test/expected/preproc-whenever.c     |  2 +-
 src/interfaces/ecpg/test/expected/sql-array.c |  2 +-
 .../ecpg/test/expected/sql-binary.c           |  2 +-
 .../ecpg/test/expected/sql-code100.c          |  2 +-
 .../ecpg/test/expected/sql-copystdout.c       |  2 +-
 .../ecpg/test/expected/sql-define.c           |  2 +-
 src/interfaces/ecpg/test/expected/sql-desc.c  |  2 +-
 .../ecpg/test/expected/sql-dynalloc.c         |  2 +-
 .../ecpg/test/expected/sql-dynalloc2.c        |  2 +-
 .../ecpg/test/expected/sql-dyntest.c          |  2 +-
 .../ecpg/test/expected/sql-execute.c          |  2 +-
 src/interfaces/ecpg/test/expected/sql-fetch.c |  2 +-
 src/interfaces/ecpg/test/expected/sql-func.c  |  2 +-
 .../ecpg/test/expected/sql-indicators.c       |  2 +-
 src/interfaces/ecpg/test/expected/sql-quote.c |  2 +-
 src/interfaces/ecpg/test/expected/sql-show.c  |  2 +-
 .../ecpg/test/expected/sql-update.c           |  2 +-
 .../ecpg/test/expected/thread-thread.c        |  2 +-
 .../test/expected/thread-thread_implicit.c    |  2 +-
 src/interfaces/ecpg/test/pg_regress.sh        | 25 +++++--------------
 46 files changed, 66 insertions(+), 70 deletions(-)

diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index b3cfd80bdc9..369c92f48ad 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.38 2007/01/11 15:47:33 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.39 2007/01/12 10:00:12 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -19,7 +19,6 @@ static pthread_once_t actual_connection_key_once = PTHREAD_ONCE_INIT;
 #endif
 static struct connection *actual_connection = NULL;
 static struct connection *all_connections = NULL;
-extern int ecpg_internal_regression_mode;
 
 #ifdef ENABLE_THREAD_SAFETY
 static void
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 6b2bbfa64be..3d8842b2aa9 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.36 2007/01/11 15:47:33 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.37 2007/01/12 10:00:12 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -16,8 +16,6 @@
 #include "pgtypes_timestamp.h"
 #include "pgtypes_interval.h"
 
-extern int ecpg_internal_regression_mode;
-
 static bool
 garbage_left(enum ARRAY_TYPE isarray, char *scan_length, enum COMPAT_MODE compat)
 {
diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h
index 8759fac4fdb..d5d44a79c0c 100644
--- a/src/interfaces/ecpg/ecpglib/extern.h
+++ b/src/interfaces/ecpg/ecpglib/extern.h
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.20 2006/10/04 00:30:11 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.21 2007/01/12 10:00:13 meskes Exp $ */
 
 #ifndef _ECPG_LIB_EXTERN_H
 #define _ECPG_LIB_EXTERN_H
@@ -12,6 +12,8 @@ enum COMPAT_MODE
 	ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE
 };
 
+extern bool ecpg_internal_regression_mode;
+
 #define INFORMIX_MODE(X) ((X) == ECPG_COMPAT_INFORMIX || (X) == ECPG_COMPAT_INFORMIX_SE)
 
 enum ARRAY_TYPE
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 122c7d63289..4273819e79d 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.33 2007/01/11 15:47:33 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.34 2007/01/12 10:00:13 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -28,7 +28,7 @@
 #endif
 #endif
 
-extern int ecpg_internal_regression_mode;
+bool ecpg_internal_regression_mode = false;
 
 static struct sqlca_t sqlca_init =
 {
@@ -228,8 +228,16 @@ ECPGdebug(int n, FILE *dbgs)
 	pthread_mutex_lock(&debug_init_mutex);
 #endif
 
-	simple_debug = n;
+	if (n > 100) 
+	{
+		ecpg_internal_regression_mode = true;
+		simple_debug = n-100;
+	}
+	else
+		simple_debug = n;
+
 	debugstream = dbgs;
+
 	ECPGlog("ECPGdebug: set to %d\n", simple_debug);
 
 #ifdef ENABLE_THREAD_SAFETY
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 66b4138c89b..c8b2327289b 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.95 2007/01/11 15:47:33 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.96 2007/01/12 10:00:13 meskes Exp $ */
 
 /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -425,7 +425,6 @@ main(int argc, char *const argv[])
 				else
 					fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
 
-				fprintf(yyout, "int ecpg_internal_regression_mode = %d;\n", regression_mode);
 				if (header_mode == false)
 				{
 					fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
@@ -437,6 +436,9 @@ main(int argc, char *const argv[])
 					fprintf(yyout, "/* End of automatic include section */\n");
 				}
 
+				if (regression_mode) 
+					fprintf(yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n");
+
 				output_line_number();
 
 				/* and parse the source */
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c
index f0090cc1976..79ab5af5aea 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "charfuncs.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
index 323e2082a90..d71be24e4e9 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dec_test.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
index 6ec78475afc..167535a59b7 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "rfmtdate.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
index 2c96cc0e76b..0b0466ae144 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "rfmtlong.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.c b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
index 9a6df4dbefc..84acd62309b 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "rnull.pgc"
 #include "sqltypes.h"
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
index 8aab843540b..bd36a2a5e33 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test_informix.pgc"
 #include "sqltypes.h"
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
index 8b0495d7a1a..db94fdf86e9 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
@@ -1,5 +1,4 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
@@ -8,6 +7,7 @@ int ecpg_internal_regression_mode = 1;
 /* Needed for informix compatibility */
 #include <ecpg_informix.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test_informix2.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.c b/src/interfaces/ecpg/test/expected/connect-test1.c
index 2f1cdbec1b2..aee8e26f1bf 100644
--- a/src/interfaces/ecpg/test/expected/connect-test1.c
+++ b/src/interfaces/ecpg/test/expected/connect-test1.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test1.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/expected/connect-test2.c b/src/interfaces/ecpg/test/expected/connect-test2.c
index 2a591867ae1..a5ab29da3f5 100644
--- a/src/interfaces/ecpg/test/expected/connect-test2.c
+++ b/src/interfaces/ecpg/test/expected/connect-test2.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test2.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/expected/connect-test3.c b/src/interfaces/ecpg/test/expected/connect-test3.c
index ba0cc5529b1..f601f9b9005 100644
--- a/src/interfaces/ecpg/test/expected/connect-test3.c
+++ b/src/interfaces/ecpg/test/expected/connect-test3.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test3.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/expected/connect-test4.c b/src/interfaces/ecpg/test/expected/connect-test4.c
index 5ebee623557..42c017471e8 100644
--- a/src/interfaces/ecpg/test/expected/connect-test4.c
+++ b/src/interfaces/ecpg/test/expected/connect-test4.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test4.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c
index 1335a919911..b226b46a03f 100644
--- a/src/interfaces/ecpg/test/expected/connect-test5.c
+++ b/src/interfaces/ecpg/test/expected/connect-test5.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "test5.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
index d6bf060aa40..413ff7acd05 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dt_test.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
index 8d9e180e5b7..bac2dd69240 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dt_test2.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
index 3d06dfdf999..48d0e6f9b1a 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "num_test.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
index ec8477fdc91..9b6bada22a1 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "num_test2.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/preproc-comment.c b/src/interfaces/ecpg/test/expected/preproc-comment.c
index 6bbc77579a9..57cd4f5e2ad 100644
--- a/src/interfaces/ecpg/test/expected/preproc-comment.c
+++ b/src/interfaces/ecpg/test/expected/preproc-comment.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "comment.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/preproc-define.c b/src/interfaces/ecpg/test/expected/preproc-define.c
index a2d14895204..44cd6eecc56 100644
--- a/src/interfaces/ecpg/test/expected/preproc-define.c
+++ b/src/interfaces/ecpg/test/expected/preproc-define.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "define.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c
index 052a4af051e..e0fc30b63be 100644
--- a/src/interfaces/ecpg/test/expected/preproc-init.c
+++ b/src/interfaces/ecpg/test/expected/preproc-init.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "init.pgc"
 
diff --git a/src/interfaces/ecpg/test/expected/preproc-type.c b/src/interfaces/ecpg/test/expected/preproc-type.c
index 034787875e7..68805fa2536 100644
--- a/src/interfaces/ecpg/test/expected/preproc-type.c
+++ b/src/interfaces/ecpg/test/expected/preproc-type.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "type.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c
index 0913ecd06be..a6beea09c80 100644
--- a/src/interfaces/ecpg/test/expected/preproc-variable.c
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "variable.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.c b/src/interfaces/ecpg/test/expected/preproc-whenever.c
index 446541edfb4..63a7d09f293 100644
--- a/src/interfaces/ecpg/test/expected/preproc-whenever.c
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "whenever.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-array.c b/src/interfaces/ecpg/test/expected/sql-array.c
index 7b996b3db8f..fc64d7220d7 100644
--- a/src/interfaces/ecpg/test/expected/sql-array.c
+++ b/src/interfaces/ecpg/test/expected/sql-array.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "array.pgc"
 #include <locale.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-binary.c b/src/interfaces/ecpg/test/expected/sql-binary.c
index 418605be6ff..8c9a5f286ad 100644
--- a/src/interfaces/ecpg/test/expected/sql-binary.c
+++ b/src/interfaces/ecpg/test/expected/sql-binary.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "binary.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-code100.c b/src/interfaces/ecpg/test/expected/sql-code100.c
index 2368b21f33f..96822bedcff 100644
--- a/src/interfaces/ecpg/test/expected/sql-code100.c
+++ b/src/interfaces/ecpg/test/expected/sql-code100.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "code100.pgc"
 
diff --git a/src/interfaces/ecpg/test/expected/sql-copystdout.c b/src/interfaces/ecpg/test/expected/sql-copystdout.c
index 4ae3e9d92e8..d0356475177 100644
--- a/src/interfaces/ecpg/test/expected/sql-copystdout.c
+++ b/src/interfaces/ecpg/test/expected/sql-copystdout.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "copystdout.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-define.c b/src/interfaces/ecpg/test/expected/sql-define.c
index e66aa1994bf..69122812c27 100644
--- a/src/interfaces/ecpg/test/expected/sql-define.c
+++ b/src/interfaces/ecpg/test/expected/sql-define.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "define.pgc"
 
diff --git a/src/interfaces/ecpg/test/expected/sql-desc.c b/src/interfaces/ecpg/test/expected/sql-desc.c
index c735f2749f9..708875a971d 100644
--- a/src/interfaces/ecpg/test/expected/sql-desc.c
+++ b/src/interfaces/ecpg/test/expected/sql-desc.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "desc.pgc"
 
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc.c b/src/interfaces/ecpg/test/expected/sql-dynalloc.c
index 5fe0584042d..ce178e8ce94 100644
--- a/src/interfaces/ecpg/test/expected/sql-dynalloc.c
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dynalloc.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc2.c b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c
index 7d38c019b28..19fd84fe94d 100644
--- a/src/interfaces/ecpg/test/expected/sql-dynalloc2.c
+++ b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dynalloc2.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.c b/src/interfaces/ecpg/test/expected/sql-dyntest.c
index 94d84e76ddf..242c93a395c 100644
--- a/src/interfaces/ecpg/test/expected/sql-dyntest.c
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "dyntest.pgc"
 /* dynamic SQL test program
diff --git a/src/interfaces/ecpg/test/expected/sql-execute.c b/src/interfaces/ecpg/test/expected/sql-execute.c
index 0fcc0126ae5..4d0ed38eb04 100644
--- a/src/interfaces/ecpg/test/expected/sql-execute.c
+++ b/src/interfaces/ecpg/test/expected/sql-execute.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "execute.pgc"
 #include <stdlib.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.c b/src/interfaces/ecpg/test/expected/sql-fetch.c
index b39ac3ffe14..78fc79e8dac 100644
--- a/src/interfaces/ecpg/test/expected/sql-fetch.c
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "fetch.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-func.c b/src/interfaces/ecpg/test/expected/sql-func.c
index 881c2a64e5b..bfa7bbdd944 100644
--- a/src/interfaces/ecpg/test/expected/sql-func.c
+++ b/src/interfaces/ecpg/test/expected/sql-func.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "func.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-indicators.c b/src/interfaces/ecpg/test/expected/sql-indicators.c
index ca3fc391e92..99be1bfc396 100644
--- a/src/interfaces/ecpg/test/expected/sql-indicators.c
+++ b/src/interfaces/ecpg/test/expected/sql-indicators.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "indicators.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.c b/src/interfaces/ecpg/test/expected/sql-quote.c
index 5fbf964b573..170c27c3dca 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.c
+++ b/src/interfaces/ecpg/test/expected/sql-quote.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "quote.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-show.c b/src/interfaces/ecpg/test/expected/sql-show.c
index 79ff09f1766..d64b6d29535 100644
--- a/src/interfaces/ecpg/test/expected/sql-show.c
+++ b/src/interfaces/ecpg/test/expected/sql-show.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "show.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/sql-update.c b/src/interfaces/ecpg/test/expected/sql-update.c
index 69052ef8eaf..ca35ed84375 100644
--- a/src/interfaces/ecpg/test/expected/sql-update.c
+++ b/src/interfaces/ecpg/test/expected/sql-update.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "update.pgc"
 #include <stdio.h>
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.c b/src/interfaces/ecpg/test/expected/thread-thread.c
index 890276c2f87..41100f7cc34 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "thread.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
index 21cf8e3c2b9..9a8bbcc434b 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
@@ -1,11 +1,11 @@
 /* Processed by ecpg (regression mode) */
-int ecpg_internal_regression_mode = 1;
 /* These include files are added by the preprocessor */
 #include <ecpgtype.h>
 #include <ecpglib.h>
 #include <ecpgerrno.h>
 #include <sqlca.h>
 /* End of automatic include section */
+#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
 #line 1 "thread_implicit.pgc"
 /*
diff --git a/src/interfaces/ecpg/test/pg_regress.sh b/src/interfaces/ecpg/test/pg_regress.sh
index 108f4140881..1396257bbaf 100644
--- a/src/interfaces/ecpg/test/pg_regress.sh
+++ b/src/interfaces/ecpg/test/pg_regress.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.16 2007/01/11 15:47:33 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.17 2007/01/12 10:00:13 meskes Exp $
 
 me=`basename $0`
 
@@ -740,6 +740,11 @@ for i in \
 	    *-*-mingw32*)
 		PLATFORM_TAG="-MinGW32"
 		;;
+	    *-*-openbsd3.8)
+		# OpenBSD 3.8 is buggy:
+		# http://archives.postgresql.org/pgsql-hackers/2006-09/msg00593.php
+		PLATFORM_TAG="-OpenBSD3.8.broken"
+		;;
 	esac
 
 	outfile_stderr="$outputdir/$outprg.stderr"
@@ -749,24 +754,6 @@ for i in \
 	# echo "$runprg > $outfile_stdout 2> $outfile_stderr"
 	$runprg > "$outfile_stdout" 2> "$outfile_stderr"
 
-	# If we don't run on the default port we'll get different output
-	# so tweak output files and replace the port number (we put a warning
-	# but the price to pay is that we have to tweak the files every time
-	# now not only if the port differs from the standard port).
-	#if [ "$i" = "connect/test1.pgc" ]; then
-		# can we use sed -i on all platforms?
-	#	for f in "$outfile_stderr" "$outfile_stdout" "$outfile_source"; do
-	#		mv $f $f.tmp
-	#		echo >> $f
-	#		echo "THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT" >> $f
-	#		echo >> $f
-			# MinGW could return such a line:
-			# "could not connect to server: Connection refused (0x0000274D/10061)"
-			#cat $f.tmp | sed -e s,$PGPORT,55432,g | sed -e "s,could not connect to server: Connection refused (0x.*/.*),could not connect to server: Connection refused,g" >> $f
-	#		rm $f.tmp
-	#	done
-	#fi
-
 	mv "$outfile_source" "$outfile_source.tmp"
 	cat "$outfile_source.tmp" | sed -e 's,^\(#line [0-9]*\) ".*/\([^/]*\)",\1 "\2",' > "$outfile_source"
 	rm "$outfile_source.tmp"
-- 
GitLab