Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clNJc-0005XQ-UG for pgsql-odbc@arkaria.postgresql.org; Tue, 07 Mar 2017 22:10:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1clNJc-0008I9-Gr for pgsql-odbc@arkaria.postgresql.org; Tue, 07 Mar 2017 22:10:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1clNJE-0007dG-F1 for pgsql-odbc@postgresql.org; Tue, 07 Mar 2017 22:10:20 +0000 Received: from mail-ua0-x235.google.com ([2607:f8b0:400c:c08::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1clNJB-0004ma-HR for pgsql-odbc@postgresql.org; Tue, 07 Mar 2017 22:10:19 +0000 Received: by mail-ua0-x235.google.com with SMTP id 72so25340499uaf.3 for ; Tue, 07 Mar 2017 14:10:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=AIb/Ov/oHp/HVFvkdI2FfmkXPDDis9H7JgTJtAqhMj8=; b=QbAD/n3AMPbqD8WlN0ZYPqNvgbK8ZthfysqlUSedh4ICr1JxXjNNRC4zBv9+c4t+99 F4rsrR/yZnuZg3m+6KSfTpmrSEClbwxr7EzSH3/8mCyT3MK8BWBdsGrwoQ3Lruu9EYRb 3/0f8XuBgXBulyC1WrLNCJR0kJGLQKcnLWm8Y4Zr45HE0rCPURvxO97bU+1UQXlpfdiG i2Rcl8EB7hwUhyTnCFMGhQbNB8BAyHD581Vls1zDwm+q1Nd2d05MV5TxDTaD2jC3YJ+V /WkKxSZTm0TQy4ZF3hdSDufLWxSsz7d7iQPqZ2ccgloqyRl7MGbqYMNrPOzShX2E8Qg9 X2rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=AIb/Ov/oHp/HVFvkdI2FfmkXPDDis9H7JgTJtAqhMj8=; b=O5R7xMbFicVjDa7WUVPS7dYcUgOYuVAOPKOwQkzDv5hKCf11hv0Ba7zfdKVXOsdYBM hAxzjGBNKq3wH611mfU1nLevZNinoZwBHXZzbwonwNymUQO8W51YMuLDx2lzObkBnegT UUxAL/QXBJFbw3JxqhM4vEx5iUG4v6rOyWGsvenedvK+saiCxx1/VvCKArvxNZqI80F7 D0a7lTfZp0tTA+1mfT9IY8YJAZj3mvBXlGiBFawekHn1w0/9RzqWxYZ9ZBPvuxyBrhcM Mku8GcuYTjfZlhX/3RWqjWxxm/EVzwG5GRiaB7L7bprez0MQZNPr4azkiBR+x+YFOt9V SPBw== X-Gm-Message-State: AMke39nBYo006IOditLm7K4KdsPLjzWEWwm10ZDFJAGamYkMWd98f5tFZRk8QvJJ3biWeIXXNs4YTrvneRG+3Q== X-Received: by 10.176.23.92 with SMTP id k28mr1658895uaf.25.1488924616455; Tue, 07 Mar 2017 14:10:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.168.130 with HTTP; Tue, 7 Mar 2017 14:10:16 -0800 (PST) In-Reply-To: References: From: "Jack C. Wei" Date: Tue, 7 Mar 2017 14:10:16 -0800 X-Google-Sender-Auth: w3UV5ihBvyIqZqEoEmOEeTK1Qwc Message-ID: Subject: Re: ODBC connections go dead after a failed query? To: "Inoue, Hiroshi" Cc: pgsql-odbc@postgresql.org Content-Type: multipart/alternative; boundary=f40304361d3adc7e54054a2b4617 X-Pg-Spam-Score: -2.0 (--) 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 --f40304361d3adc7e54054a2b4617 Content-Type: text/plain; charset=UTF-8 Hi Hiroshi, I just tried the test driver 9.6.0102 and it seems to have fixed the bug. Thank you for the good work. When can we expect an official release of the new driver? We're looking to deploy PostgreSQL in six weeks. Currently I'm using 9.3.0400 which is the last official version that does not have this issue. 9.5.0100 starts having this problem. So is 9.5.0400 and 9.6.0100 that I tried. Regards, Jack On Sat, Mar 4, 2017 at 5:48 AM, Inoue, Hiroshi wrote: > Hi Jack, > > Probably I found the cause. > Could you try the test drivers 9.6.0102 at > http://www.ne.jp/asahi/inocchichichi/entrance/psqlodbc/ > ? > > regards, > Hiroshi Inoue > > > On 2017/03/04 5:14, Jack C. Wei wrote: > >> Hi, >> >> We have some legacy SQL queries that works on SQL Server but not on >> PostgreSQL due to SQL Server-specific syntax, which we are working to >> migrate. The problem is sometimes psqlodbc just cannot seem to reset itself >> after a bad query and simply go dead. All subsequent queries on the same >> connection, legitimate or not, would fail. >> >> I've verified this can happen with the latest PostgreSQL 9.6.2 and >> psqlodbc 09_06_0100, on a Windows 7 x64 host. >> >> The offending SQL query is something like "UPDATE site SET >> image=image_old;" where [image] is BYTEA (used to be MEDIUMBLOB on SQL >> Server) and [image_old] is TEXT. PostgreSQL does not allow this, which is >> understandable. But after this query the connection goes dead, failing all >> subsequent queries with ODBC error 08S01 or HY000. While it is possible to >> detect this and reconnect as a workaround, it would be cumbersome and lead >> to unwarranted overhead. See the following excerpt from my ODBC trace log: >> >> >> PsqlOdbcBug f68-e10 EXIT SQLPrepareW with return code 0 >> (SQL_SUCCESS) >> HSTMT 0x00033EE8 >> WCHAR * 0x010F0F28 [ -3] "UPDATE site SET >> image=image_old >> > > ;\ 0" >> SDWORD -3 >> >> PsqlOdbcBug f68-e10 ENTER SQLExecute >> HSTMT 0x00033EE8 >> >> PsqlOdbcBug f68-e10 EXIT SQLExecute with return code -1 >> (SQL_ERROR) >> HSTMT 0x00033EE8 >> >> DIAG [42804] ERROR: column "image" is of type bytea but >> expression is of type text; >> Error while preparing parameters (1) >> >> PsqlOdbcBug f68-e10 ENTER SQLFreeHandle >> SQLSMALLINT 3 >> SQLHANDLE 0x00033EE8 >> >> PsqlOdbcBug f68-e10 EXIT SQLFreeHandle with return code 0 >> (SQL_SUCCESS) >> SQLSMALLINT 3 >> SQLHANDLE 0x00033EE8 >> >> PsqlOdbcBug f68-e10 ENTER SQLAllocHandle >> SQLSMALLINT 3 >> SQLHANDLE 0x000338D8 >> SQLHANDLE * 0x0035EB90 >> >> PsqlOdbcBug f68-e10 EXIT SQLAllocHandle with return code 0 >> (SQL_SUCCESS) >> SQLSMALLINT 3 >> SQLHANDLE 0x000338D8 >> SQLHANDLE * 0x0035EB90 ( 0x00D51C98) >> >> PsqlOdbcBug f68-e10 ENTER SQLPrepareW >> HSTMT 0x00D51C98 >> WCHAR * 0x010F0DE0 [ -3] "SELECT id FROM site;\ >> 0" >> SDWORD -3 >> >> PsqlOdbcBug f68-e10 EXIT SQLPrepareW with return code 0 >> (SQL_SUCCESS) >> HSTMT 0x00D51C98 >> WCHAR * 0x010F0DE0 [ -3] "SELECT id FROM site;\ >> 0" >> SDWORD -3 >> >> PsqlOdbcBug f68-e10 ENTER SQLExecute >> HSTMT 0x00D51C98 >> >> PsqlOdbcBug f68-e10 EXIT SQLExecute with return code -1 >> (SQL_ERROR) >> HSTMT 0x00D51C98 >> >> DIAG [08S01] Could not send Query(connection dead); >> Could not send Query(connection dead) (26) >> >> >> I've attached a minimal working sample code (we develop in Visual Studio >> 2013) and also the ODBC trace log. Hopefully they make it through. Any >> feedback is welcome. >> >> >> Thank you, >> Jack Wei >> >> > --f40304361d3adc7e54054a2b4617 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Hiroshi,

I just tried = the test driver 9.6.0102 and it seems to have fixed the bug. Thank you for = the good work.

When can we expect an official release of the n= ew driver? We're looking to deploy PostgreSQL in six weeks. Currently I= 'm using 9.3.0400 which is the last official version that does not have= this issue. 9.5.0100 starts having this problem. So is 9.5.0400 and 9.6.01= 00 that I tried.


Regards,
Jack

<= br>

On Sat, Mar 4, 2017 at 5:48 AM, Inoue, Hiroshi <h-inoue@dream.= email.ne.jp> wrote:
Hi Jack= ,

Probably I found the cause.
Could you try the test drivers 9.6.0102 at
http://www.ne.jp/asahi/inocchichichi/ent= rance/psqlodbc/
?

regards,
Hiroshi Inoue


On 2017/03/04 5:14, Jack C. Wei wrote:
Hi,

We have some legacy SQL queries that works on SQL Server but not on Postgre= SQL due to SQL Server-specific syntax, which we are working to migrate. The= problem is sometimes psqlodbc just cannot seem to reset itself after a bad= query and simply go dead. All subsequent queries on the same connection, l= egitimate or not, would fail.

I've verified this can happen with the latest PostgreSQL 9.6.2 and psql= odbc 09_06_0100, on a Windows 7 x64 host.

The offending SQL query is something like "UPDATE site SET image=3Dima= ge_old;" where [image] is BYTEA (used to be MEDIUMBLOB on SQL Server) = and [image_old] is TEXT. PostgreSQL does not allow this, which is understan= dable. But after this query the connection goes dead, failing all subsequen= t queries with ODBC error 08S01 or HY000. While it is possible to detect th= is and reconnect as a workaround, it would be cumbersome and lead to unwarr= anted overhead. See the following excerpt from my ODBC trace log:


PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 EXIT=C2=A0 SQLPrepareW= =C2=A0 with return code 0 (SQL_SUCCESS)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00033EE8
=C2=A0 =C2=A0 =C2=A0 =C2=A0 WCHAR *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A00x010F0F28 [=C2=A0 =C2=A0 =C2=A0 -3] "UPDATE site SET image= =3Dimage_old

;\ 0"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SDWORD=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 -3

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 ENTER SQLExecute
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00033EE8

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 EXIT=C2=A0 SQLExecute= =C2=A0 with return code -1 (SQL_ERROR)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00033EE8

=C2=A0 =C2=A0 =C2=A0 =C2=A0 DIAG [42804] ERROR: column "image" is= of type bytea but expression is of type text;
Error while preparing parameters (1)

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 ENTER SQLFreeHandle
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SQLSMALLINT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 3 <SQL_HANDLE_STMT>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SQLHANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A00x00033EE8

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 EXIT=C2=A0 SQLFreeHandl= e=C2=A0 with return code 0 (SQL_SUCCESS)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SQLSMALLINT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 3 <SQL_HANDLE_STMT>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SQLHANDLE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 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"SELECT id FROM site;\ = 0"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SDWORD=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 -3

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 EXIT=C2=A0 SQLPrepareW= =C2=A0 with return code 0 (SQL_SUCCESS)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00D51C98
=C2=A0 =C2=A0 =C2=A0 =C2=A0 WCHAR *=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A00x010F0DE0 [=C2=A0 =C2=A0 =C2=A0 -3] "SELECT id FROM site;\ = 0"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SDWORD=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 -3

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 ENTER SQLExecute
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00D51C98

PsqlOdbcBug=C2=A0 =C2=A0 =C2=A0f68-e10=C2=A0 =C2=A0 EXIT=C2=A0 SQLExecute= =C2=A0 with return code -1 (SQL_ERROR)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 HSTMT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00x00D51C98

=C2=A0 =C2=A0 =C2=A0 =C2=A0 DIAG [08S01] Could not send Query(connection de= ad);
Could not send Query(connection dead) (26)


I've attached a minimal working sample code (we develop in Visual Studi= o 2013) and also the ODBC trace log. Hopefully they make it through. Any fe= edback is welcome.


Thank you,
Jack Wei



--f40304361d3adc7e54054a2b4617--