From cf37d6846788a7c11b4a2a4500a819c3723d307c Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Fri, 14 Aug 2009 13:28:22 +0000
Subject: [PATCH] =?UTF-8?q?Made=20sure=20sqlca=20is=20reset=20for=20declar?=
 =?UTF-8?q?e=20cursor=20in=20Informix=20mode=20as=20pointed=20out=20by=20B?=
 =?UTF-8?q?=C3=B6sz=C3=B6rm=C3=A9nyi=20Zolt=C3=A1n=20<zb@cybertec.at>.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/interfaces/ecpg/ChangeLog                 |  6 ++
 src/interfaces/ecpg/compatlib/Makefile        |  4 +-
 src/interfaces/ecpg/compatlib/exports.txt     |  3 +-
 src/interfaces/ecpg/compatlib/informix.c      | 38 +++++++++-
 src/interfaces/ecpg/include/ecpg_informix.h   |  7 +-
 src/interfaces/ecpg/preproc/ecpg.addons       | 16 +++-
 src/interfaces/ecpg/preproc/ecpg.trailer      |  7 +-
 .../test/compat_informix/test_informix.pgc    |  2 +
 .../expected/compat_informix-test_informix.c  | 42 ++++++-----
 .../compat_informix-test_informix.stderr      | 74 +++++++++----------
 .../compat_informix-test_informix.stdout      |  1 +
 .../ecpg/test/expected/connect-test1.stderr   |  2 +-
 12 files changed, 132 insertions(+), 70 deletions(-)

diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 657339442bc..3a7b0b5a085 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -2419,5 +2419,11 @@ Fri, 07 Aug 2009 10:41:28 +0200
 
 	- Added STRING datatype for Informix compatibility mode. This work is
 	  based on a patch send in by Böszörményi Zoltán <zb@cybertec.at>.
+
+Fri, 14 Aug 2009 14:45:02 +0200
+
+	- Made sure sqlca is reset for declare cursor in Informix mode as
+	  pointed out by Böszörményi Zoltán <zb@cybertec.at>.
 	- Set ecpg library version to 6.2.
+	- Set compat library version to 3.2.
 	- Set ecpg version to 4.6.
diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile
index d6d4923ec04..5a37b14feda 100644
--- a/src/interfaces/ecpg/compatlib/Makefile
+++ b/src/interfaces/ecpg/compatlib/Makefile
@@ -5,7 +5,7 @@
 # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.44 2009/08/07 10:51:20 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.45 2009/08/14 13:28:22 meskes Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global
 
 NAME= ecpg_compat
 SO_MAJOR_VERSION= 3
-SO_MINOR_VERSION= 1
+SO_MINOR_VERSION= 2
 
 override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
 	-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
diff --git a/src/interfaces/ecpg/compatlib/exports.txt b/src/interfaces/ecpg/compatlib/exports.txt
index cd74e79efb5..05bd41544c9 100644
--- a/src/interfaces/ecpg/compatlib/exports.txt
+++ b/src/interfaces/ecpg/compatlib/exports.txt
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/exports.txt,v 1.4 2007/10/04 17:49:31 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/exports.txt,v 1.5 2009/08/14 13:28:22 meskes Exp $
 # Functions to be exported by ecpg_compatlib DLL
 ECPG_informix_get_var   1
 ECPG_informix_set_var   2
@@ -41,3 +41,4 @@ rtypwidth               38
 rupshift                39
 ldchar                  40
 byleng                  41
+ECPG_informix_reset_sqlca	42
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index 1118d588dcb..1d447dbe7cf 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.59 2009/06/11 14:49:13 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.60 2009/08/14 13:28:22 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -16,6 +16,34 @@
 #include <sqlca.h>
 #include <ecpgerrno.h>
 
+/* this is also defined in ecpglib/misc.c, by defining it twice we don't have to export the symbol */
+
+static struct sqlca_t sqlca_init =
+{
+	{
+		'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '
+	},
+	sizeof(struct sqlca_t),
+	0,
+	{
+		0,
+		{
+			0
+		}
+	},
+	{
+		'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '
+	},
+	{
+		0, 0, 0, 0, 0, 0
+	},
+	{
+		0, 0, 0, 0, 0, 0, 0, 0
+	},
+	{
+		'0', '0', '0', '0', '0'
+	}
+};
 static int
 deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
 {
@@ -1033,6 +1061,14 @@ ECPG_informix_get_var(int number)
 	return (ptr) ? ptr->pointer : NULL;
 }
 
+void
+ECPG_informix_reset_sqlca(void)
+{
+	struct sqlca_t *sqlca = ECPGget_sqlca();
+
+	memcpy((char *) sqlca, (char *) &sqlca_init, sizeof(struct sqlca_t));
+}
+
 int
 rsetnull(int t, char *ptr)
 {
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h
index 5f9162a9b9b..a97246b1937 100644
--- a/src/interfaces/ecpg/include/ecpg_informix.h
+++ b/src/interfaces/ecpg/include/ecpg_informix.h
@@ -1,6 +1,6 @@
 /*
  * This file contains stuff needed to be as compatible to Informix as possible.
- * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.22 2008/02/17 18:14:29 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.23 2009/08/14 13:28:22 meskes Exp $
  */
 #ifndef _ECPG_INFORMIX_H
 #define _ECPG_INFORMIX_H
@@ -34,7 +34,7 @@ extern		"C"
 #endif
 
 extern int	rdatestr(date, char *);
-extern void rtoday(date *);
+extern void 	rtoday(date *);
 extern int	rjulmdy(date, short *);
 extern int	rdefmtdate(date *, char *, char *);
 extern int	rfmtdate(date, char *, char *);
@@ -49,13 +49,14 @@ extern int	rsetnull(int, char *);
 extern int	rtypalign(int, int);
 extern int	rtypmsize(int, int);
 extern int	rtypwidth(int, int);
-extern void rupshift(char *);
+extern void 	rupshift(char *);
 
 extern int	byleng(char *, int);
 extern void ldchar(char *, int, char *);
 
 extern void ECPG_informix_set_var(int, void *, int);
 extern void *ECPG_informix_get_var(int);
+extern void ECPG_informix_reset_sqlca(void);
 
 /* Informix defines these in decimal.h */
 int			decadd(decimal *, decimal *, decimal *);
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons
index d864dfbdf7a..884ce9eb836 100644
--- a/src/interfaces/ecpg/preproc/ecpg.addons
+++ b/src/interfaces/ecpg/preproc/ecpg.addons
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.4 2009/01/30 12:53:43 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.5 2009/08/14 13:28:22 meskes Exp $ */
 
 ECPG: stmtClosePortalStmt block
 	{
@@ -238,6 +238,7 @@ ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
 ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
 	{
 		struct cursor *ptr, *this;
+		char *comment;
 
 		for (ptr = cur; ptr != NULL; ptr = ptr->next)
 		{
@@ -257,10 +258,19 @@ ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt bloc
 		argsinsert = argsresult = NULL;
 		cur = this;
 
+		comment = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
+
 		if (INFORMIX_MODE)
-			$$ = cat_str(5, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("/*"), mm_strdup(this->command), make_str("*/"));
+		{
+			if (braces_open > 0) /* we're in a function */
+			{
+				$$ = cat_str(4, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("ECPG_informix_reset_sqlca();"), comment);
+			}
+			else
+				$$ = cat_str(3, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), comment);
+		}
 		else
-			$$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
+			$$ = comment;
 	}
 ECPG: opt_hold block
 	{
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer
index 3b5d660fc41..6040a4b012d 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.10 2009/08/07 10:51:20 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.11 2009/08/14 13:28:22 meskes Exp $ */
 
 statements: /*EMPTY*/
                 | statements statement
@@ -318,7 +318,10 @@ ECPGCursorStmt:  DECLARE name cursor_options CURSOR opt_hold FOR prepared_name
 
 			cur = this;
 
-			$$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
+			if (INFORMIX_MODE && braces_open > 0) /* we're in a function */
+				$$ = cat_str(4, make_str("ECPG_informix_reset_sqlca();"), make_str("/*"), mm_strdup(this->command), make_str("*/"));
+			else
+				$$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
 		}
 		;
 
diff --git a/src/interfaces/ecpg/test/compat_informix/test_informix.pgc b/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
index ce921a6cc69..f04954bd90f 100644
--- a/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
@@ -45,7 +45,9 @@ int main(void)
 	printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
 	if (sqlca.sqlcode != 0) $rollback;
 
+	sqlca.sqlcode = 100;
 	$declare c cursor for select * from test where i <= :i;
+	printf ("%ld\n", sqlca.sqlcode);
 	openit();
 
 	deccvint(0, &j);
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 efdbd49d9bb..3d48a3a273b 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -146,10 +146,12 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
 #line 46 "test_informix.pgc"
 
 
+	sqlca.sqlcode = 100;
 	ECPG_informix_set_var( 0, &( i ), __LINE__);\
- /* declare c cursor for select * from test where i <= $1  */
-#line 48 "test_informix.pgc"
+ ECPG_informix_reset_sqlca(); /* declare c cursor for select * from test where i <= $1  */
+#line 49 "test_informix.pgc"
 
+	printf ("%ld\n", sqlca.sqlcode);
 	openit();
 
 	deccvint(0, &j);
@@ -163,10 +165,10 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
 	ECPGt_string,(c),(long)10,(long)1,(10)*sizeof(char), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 55 "test_informix.pgc"
+#line 57 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 55 "test_informix.pgc"
+#line 57 "test_informix.pgc"
 
 		if (sqlca.sqlcode == 100) break;
 		else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
@@ -188,53 +190,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "delete from test where i = $1  :: decimal", 
 	ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 73 "test_informix.pgc"
+#line 75 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 73 "test_informix.pgc"
+#line 75 "test_informix.pgc"
 
 	printf("DELETE: %ld\n", sqlca.sqlcode);
 
 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 14", ECPGt_EOIT, ECPGt_EORT);
-#line 76 "test_informix.pgc"
+#line 78 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 76 "test_informix.pgc"
+#line 78 "test_informix.pgc"
 
 	printf("Exists: %ld\n", sqlca.sqlcode);
 
 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 147", ECPGt_EOIT, ECPGt_EORT);
-#line 79 "test_informix.pgc"
+#line 81 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 79 "test_informix.pgc"
+#line 81 "test_informix.pgc"
 
 	printf("Does not exist: %ld\n", sqlca.sqlcode);
 
 	{ ECPGtrans(__LINE__, NULL, "commit");
-#line 82 "test_informix.pgc"
+#line 84 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 82 "test_informix.pgc"
+#line 84 "test_informix.pgc"
 
 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
-#line 83 "test_informix.pgc"
+#line 85 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 83 "test_informix.pgc"
+#line 85 "test_informix.pgc"
 
 	{ ECPGtrans(__LINE__, NULL, "commit");
-#line 84 "test_informix.pgc"
+#line 86 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 84 "test_informix.pgc"
+#line 86 "test_informix.pgc"
 
 
 	{ ECPGdisconnect(__LINE__, "CURRENT");
-#line 86 "test_informix.pgc"
+#line 88 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 86 "test_informix.pgc"
+#line 88 "test_informix.pgc"
 
 
 	return 0;
@@ -245,10 +247,10 @@ static void openit(void)
 	{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ", 
 	ECPGt_int,&(*( int  *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 93 "test_informix.pgc"
+#line 95 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint ( );}
-#line 93 "test_informix.pgc"
+#line 95 "test_informix.pgc"
 
 }
 
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
index bef7839e90b..89e9483ffb9 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
@@ -55,79 +55,79 @@ DETAIL:  Key (i)=(7) already exists.
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 44: correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 93: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 95: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 93: using PQexecParams
+[NO_PID]: ecpg_execute on line 95: using PQexecParams
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: free_params on line 93: parameter 1 = 14
+[NO_PID]: free_params on line 95: parameter 1 = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 93: OK: DECLARE CURSOR
+[NO_PID]: ecpg_execute on line 95: OK: DECLARE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: ecpg_execute on line 57: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
+[NO_PID]: ecpg_execute on line 57: correctly got 1 tuples with 3 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: 7 offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: 7 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: 0 offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: 0 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: test    offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: test    offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: ecpg_execute on line 57: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
+[NO_PID]: ecpg_execute on line 57: correctly got 1 tuples with 3 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: 14 offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: 14 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: 1 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 55: RESULT: a       offset: -1; array: yes
+[NO_PID]: ecpg_get_data on line 57: RESULT: a       offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: ecpg_execute on line 57: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: correctly got 0 tuples with 3 fields
+[NO_PID]: ecpg_execute on line 57: correctly got 0 tuples with 3 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 on line 55: no data found on line 55
+[NO_PID]: raising sqlcode 100 on line 57: no data found on line 57
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ecpg_execute on line 73: query: delete from test where i = $1  :: decimal; with 1 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 75: query: delete from test where i = $1  :: decimal; with 1 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 73: using PQexecParams
+[NO_PID]: ecpg_execute on line 75: using PQexecParams
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: free_params on line 73: parameter 1 = 21.0
+[NO_PID]: free_params on line 75: parameter 1 = 21.0
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 73: OK: DELETE 0
+[NO_PID]: ecpg_execute on line 75: OK: DELETE 0
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 on line 73: no data found on line 73
+[NO_PID]: raising sqlcode 100 on line 75: no data found on line 75
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ecpg_execute on line 76: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 78: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: ecpg_execute on line 78: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 76: correctly got 1 tuples with 1 fields
+[NO_PID]: ecpg_execute on line 78: correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 79: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 81: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 79: using PQexec
+[NO_PID]: ecpg_execute on line 81: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 79: correctly got 0 tuples with 1 fields
+[NO_PID]: ecpg_execute on line 81: correctly got 0 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 on line 79: no data found on line 79
+[NO_PID]: raising sqlcode 100 on line 81: no data found on line 81
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGtrans on line 82: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 84: action "commit"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 83: query: drop table test; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 85: query: drop table test; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 83: using PQexec
+[NO_PID]: ecpg_execute on line 85: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 83: OK: DROP TABLE
+[NO_PID]: ecpg_execute on line 85: OK: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 84: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 86: action "commit"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection regress1 closed
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
index 2a2fbc58f02..454fd1813b8 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
@@ -2,6 +2,7 @@ doSQLprint: Error: duplicate key value violates unique constraint "test_pkey" on
 INSERT: -239=duplicate key value violates unique constraint "test_pkey" on line 32
 doSQLprint: Error: more than one row returned by a subquery used as an expression on line 40
 SELECT: 0=
+0
 7 0 "test"
 14 1 "a"
 DELETE: 100
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.stderr b/src/interfaces/ecpg/test/expected/connect-test1.stderr
index 0f83acbcc21..de1bf17121d 100644
--- a/src/interfaces/ecpg/test/expected/connect-test1.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test1.stderr
@@ -47,7 +47,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: raising sqlcode -402 on line 53: could not connect to database "nonexistant" on line 53
 [NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 on line 54: no such connection CURRENT on line 54
+[NO_PID]: raising sqlcode -220 on line 54: connection "CURRENT" does not exist on line 54
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: ECPGconnect: opening database connectdb on localhost port <REGRESSION_PORT>  for user connectuser
 [NO_PID]: sqlca: code: 0, state: 00000
-- 
GitLab