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,
- If any parameter is unspecified, then the corresponding
- environment variable (see )
- 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 ) 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.
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++)