David Fetter <david(at)fetter(dot)org> writes:
> I'm wondering if maybe the Right Thing(TM) might be for all
> connections to return (optionally?) the version number, but that seems
> like a giant project with many backward-compatibility snags attached.
Already done, see PQparameterStatus at
http://developer.postgresql.org/docs/postgres/libpq-status.html
regards, tom lane