Am 01.04.2014 16:32, schrieb Tom Lane: > Adrian Vondendriesch <adrian.vondendrie...@credativ.de> writes: >> I patched the function conninfo_array_parse() which is used by >> PQconnectStartParams to behave like PQsetdbLogin. The patch also >> contains a document patch which clarify "unspecified" parameters. > > I see no documentation update here. I'm also fairly concerned about the > implication that no connection parameter, now or in future, can ever have > an empty string as the correct value.
If we want to preserve the possibility to except an empty string as correct value, then pgbench should initialise some variables with NULL instead of empty string. Moreover it should be documented that "unspecified" means NULL and not empty string, like in PQsetdbLogin. However, attached you will find the whole patch, including documentation. Kind Regards - Adrian
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index be0d602..0bac166 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -136,10 +136,11 @@ PGconn *PQconnectdbParams(const char * const *keywords, </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 unspecified, then the corresponding environment + variable (see <xref linkend="libpq-envars">) is checked. Parameters are + treated as unspecified if they are either NULL or contain an empty string + (""). If the environment variable is not set either, then the + indicated built-in defaults are used. </para> <para> diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index d53c41f..253615e 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -4321,7 +4321,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++)
signature.asc
Description: OpenPGP digital signature