Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WEIIT-0000H3-Aw for pgsql-odbc@arkaria.postgresql.org; Fri, 14 Feb 2014 12:55:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WEIIS-0001hd-Qc for pgsql-odbc@arkaria.postgresql.org; Fri, 14 Feb 2014 12:55:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WEIIS-0001hM-AN for pgsql-odbc@postgresql.org; Fri, 14 Feb 2014 12:55:12 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WEIIJ-0001KX-Hx for pgsql-odbc@postgresql.org; Fri, 14 Feb 2014 12:55:11 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 6621A28C20; Fri, 14 Feb 2014 04:54:59 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 5EF95182AD; Fri, 14 Feb 2014 04:54:59 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id B7E10120037; Fri, 14 Feb 2014 04:54:59 -0800 (PST) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Fri, 14 Feb 2014 04:54:58 -0800 (PST) Message-ID: <52FE1220.9050205@vmware.com> Date: Fri, 14 Feb 2014 14:54:56 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: Christoph Berg , PostgreSQL ODBC , psqlodbc@packages.debian.org Subject: Re: 09.03.0100 cursor failures on various architectures References: <20140212104524.GA4409@msgid.credativ.de> In-Reply-To: <20140212104524.GA4409@msgid.credativ.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -7.6 (-------) 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 On 02/12/2014 12:45 PM, Christoph Berg wrote: > s390x has that problem, plus an additional diff for positioned-update: > > *** /«PKGBUILDDIR»/test/expected/positioned-update.out Tue Dec 17 14:16:00 2013 > --- /«PKGBUILDDIR»/test/results/positioned-update.out Wed Feb 5 17:09:31 2014 > *************** > *** 13,19 **** > 2 2 > 3 3 > 4 4 > ! 105 5 > 7 7 > 8 8 > 9 9 > --- 13,19 ---- > 2 2 > 3 3 > 4 4 > ! 5 5 > 7 7 > 8 8 > 9 9 This is also an issue related to endianess and mismatched datatypes. The problem is with the SQLBindCol call. Positioned-update test does this: long colvalue; ... rc = SQLBindCol(hstmt, 1, SQL_C_LONG, &colvalue, 0, &indColvalue); And SQLBindCol does this: case SQL_C_SLONG: case SQL_C_LONG: len = 4; if (bind_size > 0) *((SQLINTEGER *) rgbValueBindRow) = atol(neut_str); else *((SQLINTEGER *) rgbValue + bind_row) = atol(neut_str); break; So, SQLBindPos assumes that the target variable is of type SQLINTEGER, when the caller indicated that it's SQL_C_LONG. My gut reaction is that that's bogus - if the caller said that it's of C-type long, by passing SQL_C_LONG, we should believe that, rather than assume that SQL_C_LONG means SQLINTEGER. I found a brief thread on this on the unixodbc-dev mailing list: http://mailman.unixodbc.org/pipermail/unixodbc-dev/2005-March/000396.html The same author raised the issue also on the psqlodbc mailing list: http://www.postgresql.org/message-id/flat/4224F80D.2080103@kkcsm.net#4224F80D.2080103@kkcsm.net Microsoft has a table of SQL_C_* codes and which C types they correspond to (http://msdn.microsoft.com/en-us/library/ms714556%28v=vs.85%29.aspx), but that's not taking into account other operating systems where the widths of C integer types are different. We didn't explicitly discuss in that psqlodbc mailing list thread if it's sane that SQL_C_LONG means a 32-bit integer regardless of how wide the C "long" type actually is. While I think the way the code currently works is wrong, it's probably too late to change that. It would be interesting to know how other ODBC drivers have interpreted that. Conclusion: I've committed a patch to change the test case to use SQLINTEGER instead of long as the variable's datatype. I also added an explicit test case for SQLBindCol. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc