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

Frediano Ziglio freddyz77 at tin.it
Sun Jun 25 04:25:27 EDT 2006


Il giorno ven, 23/06/2006 alle 20.17 -0500, John K. Hohm ha scritto:
> > 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.
> 

Test applied to CVS HEAD (see
http://freetds.cvs.sourceforge.net/freetds/freetds/src/odbc/unittests/)
and worked. FreeTDS 0.64 behave the same. FreeTDS 0.63 needed a small
patch for SQLFetch (backported). You can find updated post-0.63 patch at
http://freetds.sourceforge.net/.

freddy77





More information about the FreeTDS mailing list