Re: ECPGset_var

Поиск
Список
Период
Сортировка
От Boszormenyi Zoltan
Тема Re: ECPGset_var
Дата
Msg-id 4B5F56BA.90405@cybertec.at
обсуждение исходный текст
Ответ на Re: ECPGset_var  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ECPGset_var  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane írta:
> Boszormenyi Zoltan <zb@cybertec.at> writes:
>   
>> Also, another "bug" is fixed in one regression test,
>> it seems NaN is different across platforms, so
>> we must not test for it either.
>>     
>
> Really?  The main regression tests have several test cases for NaN,
> and no provision that I can see for platform dependence of the
> result.
>
> -- special inputs
> SELECT 'NaN'::float8;
>  float8 
> --------
>     NaN
> (1 row)
>
> If ecpg isn't handling this maybe you have a real bug to deal with.
>
>             regards, tom lane
>
>   

I meant this, e.g. from "gypsy_moth":

===================================

*** /export/home/tmp/pg-test/build-suncc/HEAD/pgsql.11494/src/interfaces/ecpg/test/expected/preproc-outofscope.stdout
Tue Jan 26 13:51:59 2010
 
--- /export/home/tmp/pg-test/build-suncc/HEAD/pgsql.11494/src/interfaces/ecpg/test/results/preproc-outofscope.stdout
TueJan 26 14:14:58 2010
 
***************
*** 1,4 **** id=1 t='a' d1=1.000000 d2=2.000000 c = 'a         ' id=2 t='' (NULL) d1=0.000000 (NULL) d2=0.000000 (NULL)
c= '' (NULL)
 
! id=3 t='"a"' d1=-1.000000 d2=nan c = 'a         ' id=4 t='b' d1=2.000000 d2=3.000000 c = 'b         '
--- 1,4 ---- id=1 t='a' d1=1.000000 d2=2.000000 c = 'a         ' id=2 t='' (NULL) d1=0.000000 (NULL) d2=0.000000 (NULL)
c= '' (NULL)
 
! id=3 t='"a"' d1=-1.000000 d2=NaN c = 'a         ' id=4 t='b' d1=2.000000 d2=3.000000 c = 'b         '

===================================

This is the result of a printf(). My Fedora 9 writes out "nan",
every Sparc machine in the buildfarm writes out "NaN".
This is not an ECPG parser bug, only a difference in the
system libc.

However, on "mastodon", a Windows Server 2003 machine:

===================================
--- 92,96 ---- [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 49: RESULT: NaN offset: -1;
array:yes [NO_PID]: sqlca: code: 0, state: 00000
 
! [NO_PID]: raising sqlcode -206 on line 49: invalid input syntax for floating-point type: "NaN", on line 49
! [NO_PID]: sqlca: code: -206, state: 42804
===================================


This comes from this code in data.c, in ecpg_get_data():
                               case ECPGt_float:                               case ECPGt_double:
               if (isarray && *pval == '"')                                               dres = strtod(pval + 1,
 
&scan_length);                                       else                                               dres =
strtod(pval,
&scan_length);
                                       if (isarray && *scan_length == '"')
scan_length++;
 
                                       if (garbage_left(isarray,
scan_length, compat))                                       {
ecpg_raise(lineno,
ECPG_FLOAT_FORMAT,                                                                 
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);                                               return (false);
                   }
 

It seems Windows doesn't accept "NaN" in strtod(). Is it really the case?

Best regards,
Zoltán Böszörményi

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ECPGset_var
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ECPGset_var