Skip to content

Commit ad21f34

Browse files
committed
Make connect/test1 independent of localhost IPv6.
Since commit 8688987, it has assumed "localhost" resolves to both ::1 and 127.0.0.1. We gain nothing from that assumption, and it does not hold in a default installation of Red Hat Enterprise Linux 5. Back-patch to 9.3 (all supported versions).
1 parent f5260d5 commit ad21f34

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/interfaces/ecpg/test/connect/test1.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exec sql end declare section;
5454
exec sql disconnect;
5555

5656
/* wrong port */
57-
exec sql connect to tcp:postgresql://localhost:20/connectdb user connectuser identified by connectpw;
57+
exec sql connect to tcp:postgresql://127.0.0.1:20/connectdb user connectuser identified by connectpw;
5858
/* no disconnect necessary */
5959

6060
/* wrong password */

src/interfaces/ecpg/test/expected/connect-test1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ main(void)
109109

110110

111111
/* wrong port */
112-
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://localhost:20/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
112+
{ ECPGconnect(__LINE__, 0, "tcp:postgresql://127.0.0.1:20/connectdb" , "connectuser" , "connectpw" , NULL, 0); }
113113
#line 57 "test1.pgc"
114114

115115
/* no disconnect necessary */

src/interfaces/ecpg/test/expected/connect-test1.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
[NO_PID]: sqlca: code: -402, state: 08001
5050
[NO_PID]: raising sqlcode -220 on line 54: connection "CURRENT" does not exist on line 54
5151
[NO_PID]: sqlca: code: -220, state: 08003
52-
[NO_PID]: ECPGconnect: opening database connectdb on localhost port <REGRESSION_PORT> for user connectuser
52+
[NO_PID]: ECPGconnect: opening database connectdb on 127.0.0.1 port <REGRESSION_PORT> for user connectuser
5353
[NO_PID]: sqlca: code: 0, state: 00000
5454
[NO_PID]: ECPGconnect: could not open database: could not connect to server: Connection refused
55-
Is the server running on host "localhost" (127.0.0.1) and accepting
55+
Is the server running on host "127.0.0.1" and accepting
5656
TCP/IP connections on port 20?
5757

5858
[NO_PID]: sqlca: code: 0, state: 00000

0 commit comments

Comments
 (0)