BUG #6657: Documentation bug for PQconnectdbParams

From: ediven(at)edsiohio(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6657: Documentation bug for PQconnectdbParams
Date: 2012-05-21 19:04:47
Message-ID: E1SWXuR-0003d2-5C@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 6657
Logged by: Eric Diven
Email address: ediven(at)edsiohio(dot)com
PostgreSQL version: 9.0.2
Operating system: Solaris
Description:

First off, I should thank you all for the generally excellent documentation.
The plpgsql documentation has been particularly helpful, in large part
thanks to the relevant and well-explained examples.

That said, I would humbly suggest that the documentation for the
PQconnectdbParams function omits certain details. Notably, the function
will return NULL if you pass in a keywords array with an unrecognized
keyword.

I'll be the first to admit that passing in a keyword of "host_addr" instead
of "hostaddr" was kind of a dumb mistake on my part, but I'd argue that I'd
have figured it out a lot sooner if this were the documented behavior of
PQconnectdbParams for this case.

I realize I'm submitting this against an out of date version of postgresql,
and the the behavior might have changed since then, but since the
documentation covers all of 9.0.x, I would say that it still bears
updating.

Thanks,

Eric Diven

Example code follows:

#include <libpq-fe.h>

int main (int argc, char *argv[])
{
PGconn *conn = NULL;
char *keys[] = { "host_addr", "user", "password", NULL };
char *values[] = { "192.168.0.42", "user", "password", NULL };

conn = PQconnectdbParams (keys, values, 0);

printf ("%p\n", conn);
return 0;
}

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Edmund Horner 2012-05-21 22:28:57 Re: PostgreSQL 9.2 beta1's pg_upgrade fails on Windows XP
Previous Message Andrew Dunstan 2012-05-21 18:59:34 Re: 9.2beta1 regression: pg_restore --data-only does not set sequence values any more