summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2006-08-27 16:15:42 +0000
committerMichael Meskes <meskes@postgresql.org>2006-08-27 16:15:42 +0000
commit99a5619e7b39938eb72bb57576495a27e27f5ee6 (patch)
tree60bc9098a7ac19e74bee1911ddfe1a7faa323c0b /src/interfaces/ecpg/test
parent162e8f1fd53eb485e0b7c22331444f245420d3ba (diff)
- Enabled single-quoted connection targets.
- Fixed a memory leak/segfault in unsuccessful connection. - Some changes to test files.
Diffstat (limited to 'src/interfaces/ecpg/test')
-rw-r--r--src/interfaces/ecpg/test/connect/Makefile3
-rw-r--r--src/interfaces/ecpg/test/connect/test1.pgc.in18
-rw-r--r--src/interfaces/ecpg/test/connect/test5.pgc63
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1.c77
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test1.stderr34
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.c130
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.stderr56
-rw-r--r--src/interfaces/ecpg/test/expected/connect-test5.stdout0
8 files changed, 300 insertions, 81 deletions
diff --git a/src/interfaces/ecpg/test/connect/Makefile b/src/interfaces/ecpg/test/connect/Makefile
index abb2cd9adf7..ab3750a47f9 100644
--- a/src/interfaces/ecpg/test/connect/Makefile
+++ b/src/interfaces/ecpg/test/connect/Makefile
@@ -14,7 +14,8 @@ test1.pgc: test1.pgc.in
TESTS = test1 test1.c \
test2 test2.c \
test3 test3.c \
- test4 test4.c
+ test4 test4.c \
+ test5 test5.c
all: $(TESTS)
diff --git a/src/interfaces/ecpg/test/connect/test1.pgc.in b/src/interfaces/ecpg/test/connect/test1.pgc.in
index 0300e6a369a..b2141d1c234 100644
--- a/src/interfaces/ecpg/test/connect/test1.pgc.in
+++ b/src/interfaces/ecpg/test/connect/test1.pgc.in
@@ -14,7 +14,6 @@ main(void)
{
exec sql begin declare section;
char db[200];
- char id[200];
char pw[200];
exec sql end declare section;
@@ -24,18 +23,13 @@ exec sql end declare section;
exec sql alter user connectuser ENCRYPTED PASSWORD 'connectpw';
exec sql disconnect; /* <-- "main" not specified */
- strcpy(db, "connectdb");
- strcpy(id, "main");
- exec sql connect to :db as :id;
- exec sql disconnect :id;
-
exec sql connect to connectdb@localhost as main;
exec sql disconnect main;
- exec sql connect to connectdb@localhost as main;
+ exec sql connect to connectdb@localhost:@TEMP_PORT@ as main;
exec sql disconnect main;
- exec sql connect to connectdb@localhost as main user connectuser/connectdb;
+ exec sql connect to connectdb:@TEMP_PORT@ as main;
exec sql disconnect main;
exec sql connect to tcp:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser identified by connectpw;
@@ -50,6 +44,9 @@ exec sql end declare section;
exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser using "connectpw";
exec sql disconnect;
+ exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser;
+ exec sql disconnect;
+
/* wrong db */
exec sql connect to tcp:postgresql://localhost:@TEMP_PORT@/nonexistant user connectuser identified by connectpw;
exec sql disconnect;
@@ -62,10 +59,5 @@ exec sql end declare section;
exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser identified by "wrongpw";
/* no disconnect necessary */
- /* connect twice */
- exec sql connect to connectdb as main;
- exec sql connect to connectdb as main;
- exec sql disconnect main;
-
return (0);
}
diff --git a/src/interfaces/ecpg/test/connect/test5.pgc b/src/interfaces/ecpg/test/connect/test5.pgc
new file mode 100644
index 00000000000..8601196bda5
--- /dev/null
+++ b/src/interfaces/ecpg/test/connect/test5.pgc
@@ -0,0 +1,63 @@
+/*
+ * this file tests all sorts of connecting to one single database.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* do not include regression.h */
+
+int
+main(void)
+{
+exec sql begin declare section;
+ char db[200];
+ char id[200];
+exec sql end declare section;
+
+ ECPGdebug(1, stderr);
+
+ exec sql connect to connectdb as main;
+ exec sql alter user connectuser ENCRYPTED PASSWORD 'connectpw';
+ exec sql disconnect; /* <-- "main" not specified */
+
+ strcpy(db, "connectdb");
+ strcpy(id, "main");
+ exec sql connect to :db as :id;
+ exec sql disconnect :id;
+
+ exec sql connect to connectdb as main;
+ exec sql disconnect main;
+
+ exec sql connect to "connectdb" as main;
+ exec sql disconnect main;
+
+ exec sql connect to 'connectdb' as main;
+ exec sql disconnect main;
+
+ exec sql connect to connectdb as main user connectuser/connectdb;
+ exec sql disconnect main;
+
+ exec sql connect to unix:postgresql://localhost/connectdb as main user connectuser;
+ exec sql disconnect main;
+
+ exec sql connect to "unix:postgresql://localhost/connectdb" as main user connectuser;
+ exec sql disconnect main;
+
+ exec sql connect to 'unix:postgresql://localhost/connectdb' as main user connectuser;
+ exec sql disconnect main;
+
+ exec sql connect to "unix:postgresql://200.46.204.71/connectdb" as main user connectuser;
+ exec sql disconnect main;
+
+ exec sql disconnect nonexistant;
+
+ /* connect twice */
+ exec sql connect to connectdb as main;
+ exec sql connect to connectdb as main;
+ exec sql disconnect main;
+
+ return (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.c b/src/interfaces/ecpg/test/expected/connect-test1.c
index 4c94f867959..e76e81f6843 100644
--- a/src/interfaces/ecpg/test/expected/connect-test1.c
+++ b/src/interfaces/ecpg/test/expected/connect-test1.c
@@ -27,118 +27,101 @@ main(void)
/* exec sql begin declare section */
-
#line 16 "test1.pgc"
char db [ 200 ] ;
#line 17 "test1.pgc"
- char id [ 200 ] ;
-
-#line 18 "test1.pgc"
char pw [ 200 ] ;
/* exec sql end declare section */
-#line 19 "test1.pgc"
+#line 18 "test1.pgc"
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
-#line 23 "test1.pgc"
+#line 22 "test1.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
-#line 24 "test1.pgc"
+#line 23 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 25 "test1.pgc"
+#line 24 "test1.pgc"
/* <-- "main" not specified */
- strcpy(db, "connectdb");
- strcpy(id, "main");
- { ECPGconnect(__LINE__, 0, db , NULL,NULL , id, 0); }
-#line 29 "test1.pgc"
-
- { ECPGdisconnect(__LINE__, id);}
-#line 30 "test1.pgc"
-
-
{ ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
-#line 32 "test1.pgc"
+#line 26 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
-#line 33 "test1.pgc"
+#line 27 "test1.pgc"
- { ECPGconnect(__LINE__, 0, "connectdb@localhost" , NULL,NULL , "main", 0); }
-#line 35 "test1.pgc"
+ { ECPGconnect(__LINE__, 0, "connectdb@localhost:55432" , NULL,NULL , "main", 0); }
+#line 29 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
-#line 36 "test1.pgc"
+#line 30 "test1.pgc"
- { ECPGconnect(__LINE__, 0, "connectdb@localhost" , "connectuser" , "connectdb" , "main", 0); }
-#line 38 "test1.pgc"
+ { ECPGconnect(__LINE__, 0, "connectdb:55432" , NULL,NULL , "main", 0); }
+#line 32 "test1.pgc"
{ ECPGdisconnect(__LINE__, "main");}
-#line 39 "test1.pgc"
+#line 33 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
-#line 41 "test1.pgc"
+#line 35 "test1.pgc"
{ ECPGdisconnect(__LINE__, "nonexistant");}
-#line 42 "test1.pgc"
+#line 36 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 43 "test1.pgc"
+#line 37 "test1.pgc"
strcpy(pw, "connectpw");
strcpy(db, "tcp:postgresql://localhost:55432/connectdb");
{ ECPGconnect(__LINE__, 0, db , "connectuser" , pw , NULL, 0); }
-#line 47 "test1.pgc"
+#line 41 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 48 "test1.pgc"
+#line 42 "test1.pgc"
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
-#line 50 "test1.pgc"
+#line 44 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 51 "test1.pgc"
+#line 45 "test1.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , NULL , NULL, 0); }
+#line 47 "test1.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 48 "test1.pgc"
/* wrong db */
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:55432/nonexistant" , "connectuser" , "connectpw" , NULL, 0); }
-#line 54 "test1.pgc"
+#line 51 "test1.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 55 "test1.pgc"
+#line 52 "test1.pgc"
/* wrong port */
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:0/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
-#line 58 "test1.pgc"
+#line 55 "test1.pgc"
/* no disconnect necessary */
/* wrong password */
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost:55432/connectdb" , "connectuser" , "wrongpw" , NULL, 0); }
-#line 62 "test1.pgc"
+#line 59 "test1.pgc"
/* no disconnect necessary */
- /* connect twice */
- { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
-#line 66 "test1.pgc"
-
- { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
-#line 67 "test1.pgc"
-
- { ECPGdisconnect(__LINE__, "main");}
-#line 68 "test1.pgc"
-
-
return (0);
}
diff --git a/src/interfaces/ecpg/test/expected/connect-test1.stderr b/src/interfaces/ecpg/test/expected/connect-test1.stderr
index 1dbb320a4c7..50ec23f831f 100644
--- a/src/interfaces/ecpg/test/expected/connect-test1.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test1.stderr
@@ -5,13 +5,9 @@ THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
+[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 24 Ok: ALTER ROLE
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection main closed.
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: ECPGexecute line 23 Ok: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
@@ -19,17 +15,17 @@ THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database connectdb on localhost port <DEFAULT>
+[NO_PID]: ECPGconnect: opening database connectdb on localhost port 55432
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database connectdb on localhost port <DEFAULT> for user connectuser
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port 55432
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection main closed.
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on localhost port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 in line 42, 'No such connection nonexistant in line 42.'.
+[NO_PID]: raising sqlcode -220 in line 36, 'No such connection nonexistant in line 36.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
@@ -41,21 +37,25 @@ THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port 55432 for user connectuser
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection connectdb closed.
+[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database nonexistant on localhost port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: connect: could not open database nonexistant on localhost port 55432 for user connectuser in line 54
+[NO_PID]: connect: could not open database nonexistant on localhost port 55432 for user connectuser in line 51
FATAL: database "nonexistant" does not exist
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection nonexistant closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -402 in line 54, 'Could not connect to database nonexistant in line 54.'.
+[NO_PID]: raising sqlcode -402 in line 51, 'Could not connect to database nonexistant in line 51.'.
[NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 in line 55, 'No such connection CURRENT in line 55.'.
+[NO_PID]: raising sqlcode -220 in line 52, 'No such connection CURRENT in line 52.'.
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database connectdb on localhost port 0 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: connect: could not open database connectdb on localhost port 0 for user connectuser in line 58
+[NO_PID]: connect: could not open database connectdb on localhost port 0 for user connectuser in line 55
could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 0?
@@ -63,13 +63,7 @@ THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: Connection connectdb closed.
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -402 in line 58, 'Could not connect to database connectdb in line 58.'.
+[NO_PID]: raising sqlcode -402 in line 55, 'Could not connect to database connectdb in line 55.'.
[NO_PID]: sqlca: code: -402, state: 08001
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port 55432 for user connectuser
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: connect: connection identifier main is already in use
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_finish: Connection main closed.
-[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c
new file mode 100644
index 00000000000..31eb145bf2e
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.c
@@ -0,0 +1,130 @@
+/* Processed by ecpg (4.2.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 */
+
+#line 1 "test5.pgc"
+/*
+ * this file tests all sorts of connecting to one single database.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/* do not include regression.h */
+
+int
+main(void)
+{
+/* exec sql begin declare section */
+
+
+
+#line 16 "test5.pgc"
+ char db [ 200 ] ;
+
+#line 17 "test5.pgc"
+ char id [ 200 ] ;
+/* exec sql end declare section */
+#line 18 "test5.pgc"
+
+
+ ECPGdebug(1, stderr);
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 22 "test5.pgc"
+
+ { ECPGdo(__LINE__, 0, 1, NULL, "alter user connectuser encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
+#line 23 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "CURRENT");}
+#line 24 "test5.pgc"
+ /* <-- "main" not specified */
+
+ strcpy(db, "connectdb");
+ strcpy(id, "main");
+ { ECPGconnect(__LINE__, 0, db , NULL,NULL , id, 0); }
+#line 28 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, id);}
+#line 29 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 31 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 32 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 34 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 35 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 37 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 38 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , "connectuser" , "connectdb" , "main", 0); }
+#line 40 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 41 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
+#line 43 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 44 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
+#line 46 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 47 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/connectdb" , "connectuser" , NULL , "main", 0); }
+#line 49 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 50 "test5.pgc"
+
+
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/connectdb" , "connectuser" , NULL , "main", 0); }
+#line 52 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 53 "test5.pgc"
+
+
+ { ECPGdisconnect(__LINE__, "nonexistant");}
+#line 55 "test5.pgc"
+
+
+ /* connect twice */
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 58 "test5.pgc"
+
+ { ECPGconnect(__LINE__, 0, "connectdb" , NULL,NULL , "main", 0); }
+#line 59 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 60 "test5.pgc"
+
+
+ return (0);
+}
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr
new file mode 100644
index 00000000000..a50cff0d182
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr
@@ -0,0 +1,56 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23: QUERY: alter user connectuser encrypted password 'connectpw' on connection main
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 23 Ok: ALTER ROLE
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user connectuser
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user connectuser
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user connectuser
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> for user connectuser
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: connect: non-localhost access via sockets in line 52
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode -402 in line 52, 'Could not connect to database connectdb in line 52.'.
+[NO_PID]: sqlca: code: -402, state: 08001
+[NO_PID]: raising sqlcode -220 in line 53, 'No such connection main in line 53.'.
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 in line 55, 'No such connection nonexistant in line 55.'.
+[NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: connect: connection identifier main is already in use
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_finish: Connection main closed.
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stdout b/src/interfaces/ecpg/test/expected/connect-test5.stdout
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stdout