mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
A couple of test cases had connect_timeout=14, a value that seems to have been plucked from a hat. While it's more than sufficient for normal cases, slow/overloaded buildfarm machines can get a timeout failure here, as per recent report from "sungazer". Increase to 180 seconds, which is in line with our typical timeouts elsewhere in the regression tests. Back-patch to 9.6; the code looks different in 9.5, and this doesn't seem to be quite worth the effort to adapt to that. Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sungazer&dt=2020-08-04%2007%3A12%3A22
77 lines
2.2 KiB
Plaintext
77 lines
2.2 KiB
Plaintext
/*
|
|
* 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];
|
|
char *user="regress_ecpg_user1";
|
|
exec sql end declare section;
|
|
|
|
ECPGdebug(1, stderr);
|
|
|
|
exec sql connect to ecpg2_regression as main;
|
|
exec sql alter user regress_ecpg_user2 ENCRYPTED PASSWORD 'insecure';
|
|
exec sql alter user regress_ecpg_user1 ENCRYPTED PASSWORD 'connectpw';
|
|
exec sql commit;
|
|
exec sql disconnect; /* <-- "main" not specified */
|
|
|
|
strcpy(db, "ecpg2_regression");
|
|
strcpy(id, "main");
|
|
exec sql connect to :db as :id;
|
|
exec sql disconnect :id;
|
|
|
|
exec sql connect to ecpg2_regression as main;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to "ecpg2_regression" as main;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to 'ecpg2_regression' as main;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to as main user regress_ecpg_user2/insecure;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to ecpg2_regression as main user regress_ecpg_user1/connectpw;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to unix:postgresql://localhost/ecpg2_regression as main user regress_ecpg_user1/connectpw;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to "unix:postgresql://localhost/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to 'unix:postgresql://localhost/ecpg2_regression' as main user :user USING "connectpw";
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to unix:postgresql://localhost/ecpg2_regression?connect_timeout=180&client_encoding=latin1 as main user regress_ecpg_user1/connectpw;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to "unix:postgresql://200.46.204.71/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to unix:postgresql://localhost/ as main user regress_ecpg_user2 IDENTIFIED BY insecure;
|
|
exec sql disconnect main;
|
|
|
|
/* connect twice */
|
|
exec sql connect to ecpg2_regression as main;
|
|
exec sql connect to ecpg2_regression as main;
|
|
exec sql disconnect main;
|
|
|
|
/* not connected */
|
|
exec sql disconnect nonexistent;
|
|
|
|
return 0;
|
|
}
|