From: Craig Ringer <craig@2ndquadrant.com>
To: Inoue, Hiroshi <inoue@tpf.co.jp>
Cc: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Protocol de-synchronisation bug, bogus query sent
Date: Thu, 19 Jun 2014 14:02:32 +0800
Message-ID: <53A27CF8.9090504@2ndquadrant.com> (raw)
In-Reply-To: <53A26D79.1070601@2ndquadrant.com>
References: <53A25C95.707@2ndquadrant.com>
<53A26635.4030200@tpf.co.jp>
<53A26D79.1070601@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
On 06/19/2014 12:56 PM, Craig Ringer wrote:
>
> and we're attempting to use the version obtained from the server before
> we have it, instead of the conninfo-specified version to use for
> protocol selection purposes.
The attached patch fixes this.
Pushed to branch fix-febe-protocol-desync-emptyquery
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbcAttachments:0002-Fix-use-of-server-queried-version-before-connection.patch (text/x-patch, 1.5K) download
From 33398472f7149cdd393cd89548e834bfb1835452 Mon Sep 17 00:00:00 2001
From: Craig Ringer <craig@2ndquadrant.com>
Date: Thu, 19 Jun 2014 13:56:57 +0800
Subject: [PATCH 2/2] 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 issue mentioned in the commit:
Fix FE/BE protocol loss of sync due to invalid empty query
was caused by this problem.
---
connection.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/connection.c b/connection.cindex f33a6a4..7162076 100644--- a/connection.c+++ b/connection.c@@ -2747,7 +2747,7 @@ CC_send_query_append(ConnectionClass *self, const char *query, QueryInfo *qi, UD
empty_reqs;
BOOL ReadyToReturn = FALSE,
query_completed = FALSE,
- beforeV2 = PG_VERSION_LT(self, 6.4),+ beforeV2 = !(PROTOCOL_64(&self->connInfo) || PROTOCOL_74(&self->connInfo)),
aborted = FALSE,
used_passed_result_object = FALSE,
discard_next_begin = FALSE,
--
1.9.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: craig@2ndquadrant.com, inoue@tpf.co.jp
Subject: Re: Protocol de-synchronisation bug, bogus query sent
In-Reply-To: <53A27CF8.9090504@2ndquadrant.com>
References: <53A25C95.707@2ndquadrant.com> <53A26635.4030200@tpf.co.jp> <53A26D79.1070601@2ndquadrant.com> <53A27CF8.9090504@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox