Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxVQw-0002IE-Ki for pgsql-odbc@arkaria.postgresql.org; Thu, 19 Jun 2014 06:02:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WxVQv-0002sa-TB for pgsql-odbc@arkaria.postgresql.org; Thu, 19 Jun 2014 06:02:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WxVQv-0002sT-B1 for pgsql-odbc@postgresql.org; Thu, 19 Jun 2014 06:02:49 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WxVQo-0006k9-92 for pgsql-odbc@postgresql.org; Thu, 19 Jun 2014 06:02:48 +0000 Received: from ayaki.localdomain (58-7-63-35.dyn.iinet.net.au [58.7.63.35]) by mrelayeu.kundenserver.de (node=mreue101) with ESMTP (Nemesis) id 0LjrTN-1WQudJ2AQb-00boQW; Thu, 19 Jun 2014 08:02:37 +0200 Message-ID: <53A27CF8.9090504@2ndquadrant.com> Date: Thu, 19 Jun 2014 14:02:32 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "Inoue, Hiroshi" CC: "pgsql-odbc@postgresql.org" Subject: Re: Protocol de-synchronisation bug, bogus query sent References: <53A25C95.707@2ndquadrant.com> <53A26635.4030200@tpf.co.jp> <53A26D79.1070601@2ndquadrant.com> In-Reply-To: <53A26D79.1070601@2ndquadrant.com> X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------000707060502030201060705" X-Provags-ID: V02:K0:0o4gp86lP9prqH2oikjk+beVnE5LU3dSTb0FT42o4OA e/oJqhHHpyLfaONpWtp7tSofJ4RJp2UiolGqRKSruyWaFStrGL ICtkxrtGfBJdk+LLxzPDci5D126oLHehfQndGMN0qFMmVW3A+b g2qMvLCdcjhWYBC4oZuywLW2iUGH7ie0IOgLqjdKM2SSGhREdZ rM6h7QxixJ6mjoiHJEb9fOAG/J5mZ5VA2gO3marLF7J7YB1D90 zU4px9eHWlwkIk8w6RPXaaID7br1uSsz9shIGiGJiskqadElMk EFVTsZTTLTalbZPB3O5/b3ugWyeb8EMvL0PVngKtoCy8k3op4U zdaquPc1M5KN3fyygE9uvegOQZ5a/2JbVOlBUUdbz X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------000707060502030201060705 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------000707060502030201060705 Content-Type: text/x-patch; name="0002-Fix-use-of-server-queried-version-before-connection.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0002-Fix-use-of-server-queried-version-before-connection.pat"; filename*1="ch" From 33398472f7149cdd393cd89548e834bfb1835452 Mon Sep 17 00:00:00 2001 From: Craig Ringer 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.c index 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 --------------000707060502030201060705 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --------------000707060502030201060705--