pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Koenig, Michael <Michael.Koenig@blue-yonder.com>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results
Date: Fri, 1 Jul 2016 16:35:30 +0000
Message-ID: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


view thread (2+ messages)  latest in thread

Message-ID: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com>
Permalink:  ../2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com/
Also on:    postgresql.org/message-id/2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: Michael.Koenig@blue-yonder.com
  Subject: Re: Fetch next with ODBC driver 09.05.0100 yields wrong/duplicate results
  In-Reply-To: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com>
  References: <2E728534-3F4D-46DC-914D-91ECB0C666B0@blue-yonder.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox