"Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> writes:
> Also, am I right in thinking there is no way to get an sqlstate code
> from a libpq connection, or did I miss something in the docs?
Yeah, mainly because there is not any support within libpq for
generating SQLSTATE codes for errors reported by the library itself.
Somebody should step up and fix that sometime.
regards, tom lane