File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/test/modules/libpq_pipeline Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2163,14 +2163,20 @@ print_test_list(void)
2163
2163
int
2164
2164
main (int argc , char * * argv )
2165
2165
{
2166
- const char * conninfo = "" ;
2167
2166
PGconn * conn ;
2168
2167
FILE * trace ;
2169
2168
char * testname ;
2170
2169
int numrows = 10000 ;
2171
2170
PGresult * res ;
2172
2171
int c ;
2173
2172
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
+
2174
2180
while ((c = getopt (argc , argv , "r:t:" )) != -1 )
2175
2181
{
2176
2182
switch (c )
@@ -2208,14 +2214,17 @@ main(int argc, char **argv)
2208
2214
exit (0 );
2209
2215
}
2210
2216
2217
+ /* We use expand_dbname to parse the user-provided conninfo string */
2211
2218
if (optind < argc )
2212
2219
{
2213
- conninfo = pg_strdup (argv [optind ]);
2220
+ conn_values [ 0 ] = pg_strdup (argv [optind ]);
2214
2221
optind ++ ;
2215
2222
}
2216
2223
2217
2224
/* 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 );
2219
2228
if (PQstatus (conn ) != CONNECTION_OK )
2220
2229
{
2221
2230
fprintf (stderr , "Connection to database failed: %s\n" ,
You can’t perform that action at this time.
0 commit comments