Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id AC9A1A684DE for ; Mon, 21 May 2012 16:05:01 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SWXue-0003qI-41 for pgsql-bugs@postgresql.org; Mon, 21 May 2012 19:05:00 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SWXuR-00046Z-J7 for pgsql-bugs@postgresql.org; Mon, 21 May 2012 19:04:47 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1SWXuR-0003d2-5C for pgsql-bugs@postgresql.org; Mon, 21 May 2012 19:04:47 +0000 Date: Mon, 21 May 2012 19:04:47 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6657: Documentation bug for PQconnectdbParams To: pgsql-bugs@postgresql.org From: ediven@edsiohio.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/127 X-Sequence-Number: 33098 The following bug has been logged on the website: Bug reference: 6657 Logged by: Eric Diven Email address: ediven@edsiohio.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 int main (int argc, char *argv[]) { PGconn *conn =3D NULL; char *keys[] =3D { "host_addr", "user", "password", NULL }; char *values[] =3D { "192.168.0.42", "user", "password", NULL }; conn =3D PQconnectdbParams (keys, values, 0); printf ("%p\n", conn); return 0; }