Fix use of server-queried version before connection
authorCraig Ringer <craig@2ndquadrant.com>
Thu, 19 Jun 2014 05:56:57 +0000 (13:56 +0800)
committerCraig Ringer <craig@2ndquadrant.com>
Fri, 20 Jun 2014 01:53:51 +0000 (09:53 +0800)
commita0a21dc691e580302f4109cfe3a9b9dd7f7b39ce
tree3220b41f12ff145fbdc1819256a54366f90142e8
parentcf80b1cb562b3ebb019eca51ba9fd928c9f01b5b
Fix use of server-queried version before connection

psqlODBC attempted to use the version that's queried from the server before it
was obtained from the server during the connection setup. Because the server
version is initialized to 0.0, tests for "server version >= 7.4" or "server
version >= 6.4" using the PG_VERSION_LT macro were always returning false.

Instead, use PROTOCOL_64 and PROTOCOL_74 tests against conninfo. These don't
offer any "greater than" form, so just test both. There's little point adding
anything prettier when it can all be removed when v1/v2 protocol support is
removed soon anyway.

The main symptom of this issue was that psqlODBC was sending an invalid
protocol message for the v3 protocol, "Q \0", causing the server to wait for
the second half of the length word forever. At connection close, the server
would emit:

    unexpected EOF within message length word

This issue was observed while tracking down problems with XA transactions in
MSDTC failing to commit after a successful prepare because an isolated tx
created via getLockedXAConn() got stuck here, but is not confined to that
problem.
connection.c