diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 6663c48352d..703cbac37ae 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -4379,10 +4379,11 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage, * Defaults are supplied (from a service file, environment variables, etc) * for unspecified options, but only if use_defaults is TRUE. * - * If expand_dbname is non-zero, and the value passed for keyword "dbname" is a - * connection string (as indicated by recognized_connection_string) then parse - * and process it, overriding any previously processed conflicting - * keywords. Subsequent keywords will take precedence, however. + * If expand_dbname is non-zero, and the value passed for the first occurrence + * of "dbname" keyword is a connection string (as indicated by + * recognized_connection_string) then parse and process it, overriding any + * previously processed conflicting keywords. Subsequent keywords will take + * precedence, however. */ static PQconninfoOption * conninfo_array_parse(const char *const * keywords, const char *const * values, @@ -4458,7 +4459,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, } /* - * If we are on the dbname parameter, and we have a parsed + * If we are on the first dbname parameter, and we have a parsed * connection string, copy those parameters across, overriding any * existing previous settings. */ @@ -4492,6 +4493,12 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, } } } + /* + * Forget the parsed connection string, so that any subsequent + * dbname parameters will not be expanded. + */ + PQconninfoFree(dbname_options); + dbname_options = NULL; } else { |