On Mon, Mar 10, 2008 at 12:16:52AM -0700, David Fetter wrote: > - Add to TODO: "Add SQLSTATE severity to PGconn return status."
Yes, please. I have recently been discussing this with Andreas, Bernd and Peter at Linuxtage Chemnitz. In GNUmed we want to be able to distinguish connection errors due to faulty credentials (not *which* part of the credentials only *whether* credentials are the cause) from other errors in order to react meaningfully in the program. Currently, PGconn only returns CONNECTION_BAD or _OK and an error message. The error message already says things like FATAL: password authentication failed for user ... so the level of information I want is already there. However, our code would need to parse the message to detect this state. This is a problem because the above message is translated according to the local users LC_MESSAGE setting. IOW, it'd be really helpful if the error state communicated by the message in a way independant of the wording of the message itself. Now, a technically proper way might be to change the API to return a status along with the message. A hacky but easy-to-implement solution might be to simply append or prepend a fixed, non-translated string to the message. Thanks, Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers