Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJAGz-0007iW-3c for pgsql-odbc@arkaria.postgresql.org; Sat, 02 Jul 2016 02:03:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bJAGx-0005NY-Dk for pgsql-odbc@arkaria.postgresql.org; Sat, 02 Jul 2016 02:03:07 +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 1bJAGw-0005NO-GN for pgsql-odbc@postgresql.org; Sat, 02 Jul 2016 02:03:06 +0000 Received: from mail2.asahi-net.or.jp ([202.224.39.198]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJAGs-0006z2-3b for pgsql-odbc@postgresql.org; Sat, 02 Jul 2016 02:03:04 +0000 Received: from [192.168.1.3] (h216215.dynamic.ppp.asahi-net.or.jp [61.114.216.215]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id 19C97B3F2; Sat, 2 Jul 2016 11:02:58 +0900 (JST) Subject: Re: Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results To: "Koenig, Michael" References: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com> Cc: "pgsql-odbc@postgresql.org" From: "Inoue, Hiroshi" Message-ID: <577720D4.8050605@dream.email.ne.jp> Date: Sat, 2 Jul 2016 11:03:00 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com> Content-Type: multipart/alternative; boundary="------------030202060500050205030904" X-Pg-Spam-Score: -2.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 This is a multi-part message in MIME format. --------------030202060500050205030904 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Michael, Could you please try 9.05.0200 or later? regards, Hiroshi inoue On 2016/07/02 1:35, Koenig, Michael wrote: > > Hi there! > > While developing turbodbc, a Python database driver for unixodbc, I > encountered some difficulties when testing it with PostgreSQL. > > System: Ubuntu 14.04 > > PostgreSQL ODBC driver version: 09.05.0100-2.pgdg14.04+1 (following > instructions from > http://tecadmin.net/install-postgresql-server-on-ubuntu/) > > > PostgreSQL server version: psql 9.5.3, server 9.3.13 > > Debug log: Cannot manage to activate it… (TraceFile does not work) > > What I do (summary): > > ·Create a table on the database with 102 ascending integers (1-102) > > ·Connect to PostgreSQL via unixodbc 2.2.14 > > ·Prepare and execute a statement > > ·Bind a buffer which holds 1000 64 bit integer elements > > ·Bind variable to hold number of returned elements > > ·Use SQLFetchScroll to fetch data with SQL_FETCH_NEXT > > The test should return a total of 102 values. > > What I get: > > All tests ran on Ubuntu 14.04. > > Output with odbc-postgresql package in version > odbc-postgresql=1:09.02.0100-2ubuntu1 (Ubuntu official mirror): > 102 elements > > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, > 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, > 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, > 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, > 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, > 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102] > > Output with odbc-postgresql=1:09.05.0100-2.pgdg14.04+1 (following > instructions from > http://tecadmin.net/install-postgresql-server-on-ubuntu/) > : > > 203 elements > > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, > 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, > 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, > 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, > 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, > 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 1, 2, 3, 4, > 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, > 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, > 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, > 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, > 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, > 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102] > > In between the runs, the only difference is that I run sudo apt-get > install odbc-postgresql=1:09.05.0100-2.pgdg14.04+1 to upgrade the ODBC > driver. > > The magic numbers used here (102 integers, 100 element buffer) are not > too important. I can reproduce the error (with slightly different > outcome) with other buffer sizes, including some smaller than the size > of the result set. 12 is the smallest buffer size to reproduce the > error. I need at least 102 integers to reproduce the problem. > > Here is some output with 102 integers and a buffer size of 12: > > 108 elements > > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, > 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, > 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, > 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, > 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, > 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 1, 2, 3, 4, > 5, 6, 7] > > I have tested my code with a number of databases and a number of ODBC > drivers on a number of Linux systems, and this ODBC driver is the only > one which shows the problem. > > Hope you can help me or point me to an entry in the change log which > explains the changed behavior. > > Kind regards > > Michael > --------------030202060500050205030904 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Michael,

Could you please try 9.05.0200 or later?

regards,
Hiroshi inoue

On 2016/07/02 1:35, Koenig, Michael wrote:

Hi there!

 

While developing turbodbc, a Python database driver for unixodbc, I encountered some difficulties when testing it with PostgreSQL.

 

System: Ubuntu 14.04

PostgreSQL ODBC driver version: 09.05.0100-2.pgdg14.04+1 (following instructions from http://tecadmin.net/install-postgresql-server-on-ubuntu/)

PostgreSQL server version: psql 9.5.3, server 9.3.13

Debug log: Cannot manage to activate it… (TraceFile does not work)

 

What I do (summary):

·         Create a table on the database with 102 ascending integers (1-102)

·         Connect to PostgreSQL via unixodbc 2.2.14

·         Prepare and execute a statement

·         Bind a buffer which holds 1000 64 bit integer elements

·         Bind variable to hold number of returned elements

·         Use SQLFetchScroll to fetch data with SQL_FETCH_NEXT

 

The test should return a total of 102 values.

 

What I get:

 

All tests ran on Ubuntu 14.04.

 

Output with odbc-postgresql package in version odbc-postgresql=1:09.02.0100-2ubuntu1 (Ubuntu official mirror):
102 elements

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102]

 

Output with odbc-postgresql=1:09.05.0100-2.pgdg14.04+1 (following instructions from http://tecadmin.net/install-postgresql-server-on-ubuntu/):

 

203 elements

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102]

 

In between the runs, the only difference is that I run sudo apt-get install odbc-postgresql=1:09.05.0100-2.pgdg14.04+1 to upgrade the ODBC driver.

 

The magic numbers used here (102 integers, 100 element buffer) are not too important. I can reproduce the error (with slightly different outcome) with other buffer sizes, including some smaller than the size of the result set. 12 is the smallest buffer size to reproduce the error. I need at least 102 integers to reproduce the problem.

 

Here is some output with 102 integers and a buffer size of 12:

 

108 elements

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 1, 2, 3, 4, 5, 6, 7]

 

I have tested my code with a number of databases and a number of ODBC drivers on a number of Linux systems, and this ODBC driver is the only one which shows the problem.

 

Hope you can help me or point me to an entry in the change log which explains the changed behavior.

 

Kind regards

 

Michael

--------------030202060500050205030904--