Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results - Mailing list pgsql-odbc

From Koenig, Michael
Subject Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results
Date
Msg-id 2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com
Whole thread Raw
Responses Re: Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results  ("Inoue, Hiroshi" <h-inoue@dream.email.ne.jp>)
List pgsql-odbc

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

pgsql-odbc by date:

Previous
From: Jan Espen Kleivane
Date:
Subject: Re: psqlodbc_x64 timeout available?
Next
From: "Inoue, Hiroshi"
Date:
Subject: Re: Updateable cursors ODBC configuration Partition Issue