[freetds] Duplicate rows returned with one particular query

Luke Benstead kazade at gmail.com
Wed May 16 09:08:12 EDT 2007


Dear all,

I have been using PyODBC to write cross platform code that connects to an
MS-SQL database which uses freetds. Earlier today we discovered a strange
bug that only occurs on linux. We have a query which is the following:

SELECT ID
FROM  vwSomeView
WHERE (EmailAddress = 'someone at email.com')

Besides the column name, view name and email address that is the complete
query. There IS only 1 result in the database that matches that email
address. On Windows we get one result back. On linux we get back 2 rows; the
same row twice.

At first I suspected PyODBC but looking at the code it doesn't seem to do
much except call SQLFetch() and there is no linux specific code. So I turned
up the logging on freetds which gives me the following:

13:49:02.901895 processing result tokens.  marker is  fd(DONE)
13:49:02.901933 tds_process_end: more_results = 1
        was_cancelled = 0
        error = 0
        done_count_valid = 0
13:49:02.901948 processing result tokens.  marker is  fd(DONE)
13:49:02.901960 tds_process_end: more_results = 1
        was_cancelled = 0
        error = 0
        done_count_valid = 0
13:49:02.901971 processing result tokens.  marker is  fd(DONE)
13:49:02.901983 tds_process_end: more_results = 0
        was_cancelled = 0
        error = 0
        done_count_valid = 0

which looks to me like it processes the row twice.

What makes this bug even more odd is that if I replace:

'SELECT ID' with 'SELECT *' only one row is returned.

I was using freetds version 0.63 (the one that comes with Ubuntu Feisty) but
i downloaded and installed the latest CVS snapshot and that does the same
thing. I have attached the log so that hopefully someone can help with my
problem.

Thanks,

Luke.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds.log
Type: text/x-log
Size: 13400 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20070516/ad2fcc73/attachment.bin 


More information about the FreeTDS mailing list