Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9880fea

Browse files
committed
Allow "dbname" from connection string to be overridden in PQconnectDBParams
If the "dbname" attribute in PQconnectDBParams contained a connection stringor URI (and expand_dbname = TRUE), the database name from the connectionstring could not be overridden by a subsequent "dbname" keyword in thearray. That was not intentional; all other options can be overridden.Furthermore, any subsequent "dbname" caused the connection string from thefirst dbname value to be processed again, overriding any values for the sameoptions that were given between the connection string and the second dbnameoption.In the passing, clarify in the docs that only the first dbname option in thearray is parsed as a connection string.Alex Shulgin. Backpatch to all supported versions.
1 parent1f35170 commit9880fea

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,9 +4221,9 @@ conninfo_array_parse(const char **keywords, const char **values,
42214221
}
42224222

42234223
/*
4224-
* If we are on the dbname parameter, and we have a parsed
4225-
*conninfo string, copy those parameters across, overriding any
4226-
* existing previous settings
4224+
* If we are on thefirstdbname parameter, and we have a parsed
4225+
*connection string, copy those parameters across, overriding any
4226+
* existing previous settings.
42274227
*/
42284228
if (strcmp(pname,"dbname")==0&&str_options)
42294229
{
@@ -4255,6 +4255,12 @@ conninfo_array_parse(const char **keywords, const char **values,
42554255
}
42564256
}
42574257
}
4258+
/*
4259+
* Forget the parsed connection string, so that any subsequent
4260+
* dbname parameters will not be expanded.
4261+
*/
4262+
PQconninfoFree(str_options);
4263+
str_options=NULL;
42584264
}
42594265
else
42604266
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp