aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/libpq/fe-connect.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index d522a9c12d1..6ac3774d842 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -4460,9 +4460,9 @@ conninfo_array_parse(const char **keywords, const char **values,
}
/*
- * If we are on the dbname parameter, and we have a parsed
- * conninfo string, copy those parameters across, overriding any
- * existing previous settings
+ * If we are on the first dbname parameter, and we have a parsed
+ * connection string, copy those parameters across, overriding any
+ * existing previous settings.
*/
if (strcmp(pname, "dbname") == 0 && str_options)
{
@@ -4494,6 +4494,12 @@ conninfo_array_parse(const char **keywords, const char **values,
}
}
}
+ /*
+ * Forget the parsed connection string, so that any subsequent
+ * dbname parameters will not be expanded.
+ */
+ PQconninfoFree(str_options);
+ str_options = NULL;
}
else
{