Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af81259

Browse files
JelteFCommitfest Bot
authored and
Commitfest Bot
committed
Use latest protocol version in libpq_pipeline tests
To be able to test new protocol features added by future commits, we start requesting the latest protocol version in our libpq_pipeline test.
1 parent 58255c0 commit af81259

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/test/modules/libpq_pipeline/libpq_pipeline.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,14 +2163,20 @@ print_test_list(void)
21632163
int
21642164
main(int argc, char **argv)
21652165
{
2166-
const char *conninfo = "";
21672166
PGconn *conn;
21682167
FILE *trace;
21692168
char *testname;
21702169
int numrows = 10000;
21712170
PGresult *res;
21722171
int c;
21732172

2173+
/*
2174+
* dbname = "" because we use expand_dbname, so it's a no-op unless the
2175+
* user provides something else
2176+
*/
2177+
char *conn_keywords[3] = {"dbname", "max_protocol_version"};
2178+
char *conn_values[3] = {"", "latest"};
2179+
21742180
while ((c = getopt(argc, argv, "r:t:")) != -1)
21752181
{
21762182
switch (c)
@@ -2208,14 +2214,17 @@ main(int argc, char **argv)
22082214
exit(0);
22092215
}
22102216

2217+
/* We use expand_dbname to parse the user-provided conninfo string */
22112218
if (optind < argc)
22122219
{
2213-
conninfo = pg_strdup(argv[optind]);
2220+
conn_values[0] = pg_strdup(argv[optind]);
22142221
optind++;
22152222
}
22162223

22172224
/* Make a connection to the database */
2218-
conn = PQconnectdb(conninfo);
2225+
conn = PQconnectdbParams((const char *const *) &conn_keywords,
2226+
(const char *const *) &conn_values,
2227+
1);
22192228
if (PQstatus(conn) != CONNECTION_OK)
22202229
{
22212230
fprintf(stderr, "Connection to database failed: %s\n",

0 commit comments

Comments
 (0)