[freetds] Warning return as copy of last result row (was: Warning: Null value is eliminated by an aggregate or other SET operation.)

John K. Hohm jhohm at acm.org
Fri Jun 23 21:17:12 EDT 2006


> Why does the following code print out the last row twice.  Once with
> 'ret == SQL_SUCCESS' and once when 'ret == SQL_SUCCESS_WITH_INFO'?

This is a bug in the FreeTDS OBDC driver.  It can be seen without a test
table when the following query returns two NULL rows instead of one:

select max(a) as foo from (select cast(null as int) as a) as test

The FreeTDS SQLFetch return values (3) and diagnostics (wrong):

SQL_SUCCESS
SQL_SUCCESS_WITH_INFO 01003:1:8153:[FreeTDS][SQL Server]Warning: Null
value is eliminated by an aggregate or other SET operation.
SQL_NO_DATA

The Microsoft SQLFetch return values (2) and diagnostics (correct):

SQL_SUCCESS
SQL_NO_DATA 01003:1:8153:[Microsoft][ODBC SQL Server Driver][SQL
Server]Warning: Null value is eliminated by an aggregate or other SET
operation.

I have attached a patch to freetds-0.63 that creates a unittest showing
this bug, and a TDSDUMP log of the test failing against a Microsoft SQL
Server 2000 version 8.00.2039 (SP4) from my Debian GNU/Linux machine.

-- 
John K. Hohm
<jhohm at acm.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freetds-0.63-odbc-unittest-warning.patch.txt
Url: http://lists.ibiblio.org/pipermail/freetds/attachments/20060623/4b978aed/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tdsdump.txt
Url: http://lists.ibiblio.org/pipermail/freetds/attachments/20060623/4b978aed/attachment-0001.txt 


More information about the FreeTDS mailing list