mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
libpq: have PQconnectdbParams() and PQpingParams accept "" as default
Previously, these functions treated "" optin values as defaults in some ways, but not in others, like when comparing to .pgpass. Also, add documentation to clarify that now "" and NULL use defaults, like PQsetdbLogin() has always done. BACKWARD INCOMPATIBILITY Patch by Adrian Vondendriesch, docs by me Report by Jeff Janes
This commit is contained in:
parent
66b1084e2c
commit
13ecb822e8
@ -131,15 +131,15 @@ PGconn *PQconnectdbParams(const char * const *keywords,
|
||||
<para>
|
||||
The passed arrays can be empty to use all default parameters, or can
|
||||
contain one or more parameter settings. They should be matched in length.
|
||||
Processing will stop with the last non-<symbol>NULL</symbol> element
|
||||
of the <literal>keywords</literal> array.
|
||||
Processing will stop at the first <symbol>NULL</symbol> element
|
||||
in the <literal>keywords</literal> array.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If any parameter is unspecified, then the corresponding
|
||||
environment variable (see <xref linkend="libpq-envars">)
|
||||
is checked. If the environment variable is not set either,
|
||||
then the indicated built-in defaults are used.
|
||||
If any parameter is NULL or an emptry string, the corresponding
|
||||
environment variable (see <xref linkend="libpq-envars">) is checked.
|
||||
If the environment variable is not set either, then the indicated
|
||||
built-in defaults are used.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -4357,7 +4357,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
|
||||
const char *pname = keywords[i];
|
||||
const char *pvalue = values[i];
|
||||
|
||||
if (pvalue != NULL)
|
||||
if (pvalue != NULL && pvalue[0] != '\0')
|
||||
{
|
||||
/* Search for the param record */
|
||||
for (option = options; option->keyword != NULL; option++)
|
||||
|
Loading…
Reference in New Issue
Block a user