Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors

Lists: pgsql-hackers
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Zoltan Boszormenyi <zb(at)cybertec(dot)at>
Subject: out-of-scope cursor errors
Date: 2010-01-29 04:14:41
Message-ID: 4B6260B1.5080801@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


We seem to have a large portion of the buildfarm red from the ECPG
tests, presumably due to the recently applied out-of-scope cursor patches.

cheers

andrew


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: out-of-scope cursor errors
Date: 2010-01-29 05:32:20
Message-ID: 4B6272E4.8010105@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan írta:
>
> We seem to have a large portion of the buildfarm red from the ECPG
> tests, presumably due to the recently applied out-of-scope cursor
> patches.
>
> cheers
>
> andrew

Hi.

I know. Patches were already posted for that,
waiting for Michael to review and apply it.
Look at the commitfest page.

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/


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: out-of-scope cursor errors
Date: 2010-01-29 16:28:55
Message-ID: 20100129162855.GA1365@hyperion.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jan 29, 2010 at 06:32:20AM +0100, Boszormenyi Zoltan wrote:
> I know. Patches were already posted for that,
> waiting for Michael to review and apply it.

Just came back from another trip. Patch works on my system, so I committed it.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-01-29 16:48:56
Message-ID: 4B631178.9070507@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes írta:
> On Fri, Jan 29, 2010 at 06:32:20AM +0100, Boszormenyi Zoltan wrote:
>
>> I know. Patches were already posted for that,
>> waiting for Michael to review and apply it.
>>
>
> Just came back from another trip. Patch works on my system, so I committed it.
>
> Michael
>

Thanks. Hopefully that will make the buildfarm green from this problem.
As you might have noticed, the fix you just committed deleted the test
for NaN in the outofscope.pgc regression test, which I tried to fix
separately.

The buildfarm revealed a problem with NaN/Inf handling, like:
- Windows (and mybe others) don't accept "NaN" in strtod()
- different UNIX(-like) platforms write out different strings in printf()
for a double variable storing. NaN. E.g.: Linux: "nan",
Solaris: "NaN", AIX: "NaNQ"

Can you also review the NaN/Infinity patch, too? This fix uses
the same methods as the backend, i.e. looking for special strings
and attempt to handle them in a portable way. There is one
possible problem regarding NaNs and risnull()/rsetnull():
I had to introduce a new symbol (NUMERIC_NULL) for
handling NULL inline in the numeric value itself.

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/


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-01-30 10:09:34
Message-ID: 4B64055E.6070008@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Boszormenyi Zoltan írta:
> - different UNIX(-like) platforms write out different strings in printf()
> for a double variable storing. NaN. E.g.: Linux: "nan",
> Solaris: "NaN", AIX: "NaNQ"
>

After I sent it and reread my mail, I realized that my fix
wouldn't be enough because of the above: ECPG uses sprintf()
for float and double, and just like in the backend, a common
code to send "NaN" and +/- "Infinity" to the server is needed.
New patch is attached.

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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-4-ctxdiff.patch text/x-patch 44.0 KB

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-02 14:15:22
Message-ID: 20100202141522.GA31552@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Jan 30, 2010 at 11:09:34AM +0100, Boszormenyi Zoltan wrote:
> After I sent it and reread my mail, I realized that my fix
> wouldn't be enough because of the above: ECPG uses sprintf()
> for float and double, and just like in the backend, a common
> code to send "NaN" and +/- "Infinity" to the server is needed.
> New patch is attached.

Does it work for you? I get regression test failures. Haven't looked into the
function yet though.

*** /home/michael/technik/sources/archive/postgresql/pgsql/src/interfaces/ecpg.nan/test/expected/pgtypeslib-nan_test.stderr 2010-02-02 14:10:30.000000000 +0100
--- /home/michael/technik/sources/archive/postgresql/pgsql/src/interfaces/ecpg.nan/test/results/pgtypeslib-nan_test.stderr 2010-02-02 15:11:17.000000000 +0100
***************
*** 38,44 ****
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = nan
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
--- 38,44 ----
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 1
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = NaN
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
***************
*** 70,76 ****
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = inf
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
--- 70,76 ----
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = Infinity
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
***************
*** 102,108 ****
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 3
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = -inf
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000
--- 102,108 ----
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 39: parameter 1 = 3
[NO_PID]: sqlca: code: 0, state: 00000
! [NO_PID]: free_params on line 39: parameter 2 = -Infinity
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000

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

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-02 14:34:24
Message-ID: 4B6837F0.3040608@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes írta:
> On Sat, Jan 30, 2010 at 11:09:34AM +0100, Boszormenyi Zoltan wrote:
>
>> After I sent it and reread my mail, I realized that my fix
>> wouldn't be enough because of the above: ECPG uses sprintf()
>> for float and double, and just like in the backend, a common
>> code to send "NaN" and +/- "Infinity" to the server is needed.
>> New patch is attached.
>>
>
> Does it work for you? I get regression test failures. Haven't looked into the
> function yet though.
>

Arggg. I didn't update the regression test's stderr.
Actually, I didn't do "make install" before running "make check"
and the target directory had the libraries with my previous changeset.
The diff you quoted reflects the last change. Result of
double d; /* contains NaN or +/- INF */
printf("%lf", d);
is platform-dependent, the new string is
"fixed" across all platforms.

Here's the new patch with the updated regression test.

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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-5-ctxdiff.patch text/x-patch 43.9 KB

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-02 16:09:13
Message-ID: 20100202160913.GA14861@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 02, 2010 at 03:34:24PM +0100, Boszormenyi Zoltan wrote:
> Here's the new patch with the updated regression test.

Committed. Thanks a lot.

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-03 09:59:57
Message-ID: 4B69491D.8090508@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes írta:
> On Tue, Feb 02, 2010 at 03:34:24PM +0100, Boszormenyi Zoltan wrote:
>
>> Here's the new patch with the updated regression test.
>>
>
> Committed. Thanks a lot.
>
> Michael
>

Tom Lane committed a fix for Windows, there was a missing
#include <float.h>
in execute.c, but there is another problem on Windows, which
I can't fix since I don't have a Windows build system.
The linker also complains about missing _isnan(). Can someone help?
The equivalent of "-lm" is needed for the cl linker command.

Also, another oversight needs fixing on my part, for which
the patch is atttached. The INSERT statement in nan_test.pgc
contains platform dependent strings, "inf" instead of "infinity".

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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-8-ctxdiff.patch text/x-patch 3.4 KB

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Meskes <meskes(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-03 13:57:19
Message-ID: 20100203135719.GA21721@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Feb 03, 2010 at 10:59:57AM +0100, Boszormenyi Zoltan wrote:
> Also, another oversight needs fixing on my part, for which
> the patch is atttached. The INSERT statement in nan_test.pgc
> contains platform dependent strings, "inf" instead of "infinity".

Committed.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-04 14:55:06
Message-ID: 4B6ADFCA.9070005@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

I added the #include <float.h> to the nan_test.pgc in the hope
it fixes the Windows machines in the buildfarm.

The patch also contains cleanups in the outofscope and sqlda
regression tests so they do
#include <pgtypes_numeric.h>
instead of
exec sql include pgtypes_numeric.h;
The results of these two regression tests were affected
when I modified this particular header because of this.

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/

Attachment Content-Type Size
pg85-cleanup-regr-tests-2-ctxdiff.patch text/x-patch 84.6 KB

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG Re: out-of-scope cursor errors
Date: 2010-02-04 17:03:52
Message-ID: 20100204170352.GA5030@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Feb 04, 2010 at 03:55:06PM +0100, Boszormenyi Zoltan wrote:
> I added the #include <float.h> to the nan_test.pgc in the hope
> it fixes the Windows machines in the buildfarm.

I already commited this earlier today after looking at the problem myself. But
of course I'm also just hoping as I do not have a Windows build system either.

So could you please re-diff?

> The patch also contains cleanups in the outofscope and sqlda
> regression tests so they do
> #include <pgtypes_numeric.h>
> instead of
> exec sql include pgtypes_numeric.h;

Is there a reason for this?

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-16 11:16:34
Message-ID: 4B7A7E92.1000800@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

buildfarm member "pika" fails the NaN test.
Does FreeBSD/MIPS really return true for isinf(NaN)?
Anyway, the attached patch tries to fix the test case
by testing isnan() first and doesn't check isinf()
if isnan() returned true.

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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-10-ctxdiff.patch text/x-patch 1.6 KB

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-16 11:21:34
Message-ID: 4B7A7FBE.1090805@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Boszormenyi Zoltan írta:
> Hi,
>
> buildfarm member "pika" fails the NaN test.
> Does FreeBSD/MIPS really return true for isinf(NaN)?
> Anyway, the attached patch tries to fix the test case
> by testing isnan() first and doesn't check isinf()
> if isnan() returned true.
>

I lied in the patch name, it wasn't a context diff.
Also, the same remedy seems to be needed in ecpglib/execute.c, too.

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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-11-ctxdiff.patch text/x-patch 4.0 KB

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-16 18:41:50
Message-ID: 20100216184150.GA5305@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 16, 2010 at 12:21:34PM +0100, Boszormenyi Zoltan wrote:
> > Does FreeBSD/MIPS really return true for isinf(NaN)?

Actually it's a netbsd beta version, so maybe there's a bug in their libc.

But anyway, the patch doesn't seem to hurt, so I committed it.

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-16 19:01:36
Message-ID: 4B7AEB90.2040705@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes írta:
> On Tue, Feb 16, 2010 at 12:21:34PM +0100, Boszormenyi Zoltan wrote:
>
>>> Does FreeBSD/MIPS really return true for isinf(NaN)?
>>>
>
> Actually it's a netbsd beta version, so maybe there's a bug in their libc.
>

I realized my typo after sending my mail. Sorry if I offended anyone
calling NetBSD FreeBSD. :-)

> But anyway, the patch doesn't seem to hurt, so I committed it.
>

Thanks.

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/


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-16 21:28:00
Message-ID: 201002162228.00910.meskes@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> I realized my typo after sending my mail. Sorry if I offended anyone
> calling NetBSD FreeBSD. :-)

I was trying to stress the *beta* status. Maybe someone into NetBSD might be
interested in reporting this as a bug. At least it behaves different to all
other archs we have.

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-17 07:50:48
Message-ID: 20100217075048.GA27968@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 16, 2010 at 10:28:00PM +0100, Michael Meskes wrote:
> I was trying to stress the *beta* status. Maybe someone into NetBSD might be
> interested in reporting this as a bug. At least it behaves different to all
> other archs we have.

Hmm, it seems the patch didn't work. Back to the drawing board.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-17 09:20:56
Message-ID: 4B7BB4F8.8080407@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes írta:
> On Tue, Feb 16, 2010 at 10:28:00PM +0100, Michael Meskes wrote:
>
>> I was trying to stress the *beta* status. Maybe someone into NetBSD might be
>> interested in reporting this as a bug. At least it behaves different to all
>> other archs we have.
>>
>
> Hmm, it seems the patch didn't work. Back to the drawing board.
>

I hope the amd64 version of NetBSD 5.0.2 behaves similarly,
I can only try it as a VM guest...

--
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/


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-17 11:18:17
Message-ID: 4B7BD079.1070604@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Boszormenyi Zoltan írta:
> Michael Meskes írta:
>
>> On Tue, Feb 16, 2010 at 10:28:00PM +0100, Michael Meskes wrote:
>>
>>
>>> I was trying to stress the *beta* status. Maybe someone into NetBSD might be
>>> interested in reporting this as a bug. At least it behaves different to all
>>> other archs we have.
>>>
>>>
>> Hmm, it seems the patch didn't work. Back to the drawing board.
>>
>>
>
> I hope the amd64 version of NetBSD 5.0.2 behaves similarly,
> I can only try it as a VM guest...
>

NetBSD 5.0.2/x86_64 passed all both the main and the ECPG
"make check" tests. The BETA might have had a bug or
NetBSD/MIPS has some quirks I can't solve. Now what?

On a sidenote, this machine fails for the 8.4 STABLE tree, too,
in the main "make check"...

Is this buildfarm member for detecting bugs in the already
obsolete NetBSD 5.0 BETA, or what? The final 5.0 and
two bugfix releases are already out for a while. The owner
of that particular machine should upgrade.

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/


From: Rémi Zara <remi(dot)zara(at)free(dot)fr>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-24 17:05:15
Message-ID: F7379F65-8E76-4470-91EC-99C6347C3D47@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 17 févr. 2010 à 12:18, Boszormenyi Zoltan a écrit :
>
>
> Is this buildfarm member for detecting bugs in the already
> obsolete NetBSD 5.0 BETA, or what? The final 5.0 and
> two bugfix releases are already out for a while. The owner
> of that particular machine should upgrade.

I upgraded pika to NetBSD 5.0.2, and the problem is still there.
There are some tests (in "core") which tests for NaN and Infinity, which pass. So either those tests are insufficient, or the code does something different there.
Anything you want me to try ?

Regards,

Rémi Zara


From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-24 17:14:45
Message-ID: 4EA8EB51-583C-4F34-B64F-88C367B2E921@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 17 févr. 2010 à 12:18, Boszormenyi Zoltan a écrit :

> Is this buildfarm member for detecting bugs in the already
> obsolete NetBSD 5.0 BETA, or what? The final 5.0 and
> two bugfix releases are already out for a while. The owner
> of that particular machine should upgrade.

I upgraded pika to NetBSD 5.0.2, and the problem is still there.
There are some tests (in "core") which tests for NaN and Infinity, which pass. So either those tests are insufficient, or the code does something different there.
Anything you want me to try ?

Regards,

Rémi Zara


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Rémi Zara <remi(dot)zara(at)free(dot)fr>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-24 17:58:31
Message-ID: 4B8568C7.1060305@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Rémi Zara írta:
> Le 17 févr. 2010 à 12:18, Boszormenyi Zoltan a écrit :
>
>> Is this buildfarm member for detecting bugs in the already
>> obsolete NetBSD 5.0 BETA, or what? The final 5.0 and
>> two bugfix releases are already out for a while. The owner
>> of that particular machine should upgrade.
>>
>
>
> I upgraded pika to NetBSD 5.0.2,

Thanks very much for that.

> and the problem is still there.
>

:-(

> There are some tests (in "core") which tests for NaN and Infinity, which pass. So either those tests are insufficient, or the code does something different there.
> Anything you want me to try ?
>

Here's the attached test code. Compile it with

gcc -Wall -o nantest nantest.c -lm

and run it. It tests NAN anf INFINITY values with isinf() and isnan().
The expected output is:

==================
$ ./nantest
computed NAN
1 0
computed INFINITY
0 1
==================

Instead of "computed", NetBSD/x86-64 prints "defined"
but the test results are the same as under Linux/x86-64.

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/

Attachment Content-Type Size
nantest.c text/x-csrc 603 bytes

From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-24 19:45:12
Message-ID: 071DF5FD-0A11-48DD-ADAA-A0CA6AC2A89C@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 24 févr. 2010 à 18:58, Boszormenyi Zoltan a écrit :
>
> Here's the attached test code. Compile it with
>
> gcc -Wall -o nantest nantest.c -lm
>
> and run it. It tests NAN anf INFINITY values with isinf() and isnan().
> The expected output is:
>
> ==================
> $ ./nantest
> computed NAN
> 1 0
> computed INFINITY
> 0 1
> ==================
>
> Instead of "computed", NetBSD/x86-64 prints "defined"
> but the test results are the same as under Linux/x86-64.
>

Here it is :

-bash-4.1$ gcc -Wall -o nantest nantest.c -lm
-bash-4.1$ ./nantest
defined NAN
0 1
defined INFINITY
0 1

Ok. So, on NetBSD/mips (#ifdef __NetBSD__ && __mips__), isnan(NAN) is true, isnan((double)NAN) is false, and isnan((double)(0.0 / 0.0)) is true.

Regards,

Rémi Zara


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Rémi Zara <remi_zara(at)mac(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-25 10:26:12
Message-ID: 4B865044.5070105@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Rémi Zara írta:
> Le 24 févr. 2010 à 18:58, Boszormenyi Zoltan a écrit :
>
>> Here's the attached test code. Compile it with
>>
>> gcc -Wall -o nantest nantest.c -lm
>>
>> and run it. It tests NAN anf INFINITY values with isinf() and isnan().
>> The expected output is:
>>
>> ==================
>> $ ./nantest
>> computed NAN
>> 1 0
>> computed INFINITY
>> 0 1
>> ==================
>>
>> Instead of "computed", NetBSD/x86-64 prints "defined"
>> but the test results are the same as under Linux/x86-64.
>>
>>
>
> Here it is :
>

First, thanks for running it.

> -bash-4.1$ gcc -Wall -o nantest nantest.c -lm
> -bash-4.1$ ./nantest
> defined NAN
> 0 1
>

So: isnan((double)NAN) == false, isinf((double)NAN) == true?
No wonder this causes a little problem.

> defined INFINITY
> 0 1
>
> Ok. So, on NetBSD/mips (#ifdef __NetBSD__ && __mips__), isnan(NAN) is true, isnan((double)NAN) is false, and isnan((double)(0.0 / 0.0)) is true.
>
> Regards,
> Rémi Zara
>

NAN on NetBSD/x86-64 is defined as:

extern const union __float_u __nanf;
#define NAN __nanf.__val

I would guess that it's similar on mips. Is is possible that
NetBSD/mips has a conversion bug?

What I don't get is that the code I used in ECPG and in this
test code is the same as in src/backend/utils/adt/float.c. E.g.:
float8in sees "NaN" -> value will be (double)NAN
float8out sees isnan(value) -> outputs "NaN" string

Can someone shed some light on why the backend
doesn't get the problem as above? :-(

As Rémi says, isnan((double)(0.0 / 0.0)) == true for him.
Michael: IIRC, IEEE754 explicit about that the (0.0/0.0) division
produces NaN. How about doing it explicitely in ECPG?

Rémi: please, run this code to confirm the above?

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/

Attachment Content-Type Size
nantest1.c text/x-csrc 531 bytes

From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-25 10:38:24
Message-ID: 0A033239-4803-4D6B-A7CD-3FC75F8CD46D@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 25 févr. 2010 à 11:26, Boszormenyi Zoltan a écrit :
>
> NAN on NetBSD/x86-64 is defined as:
>
> extern const union __float_u __nanf;
> #define NAN __nanf.__val
>

Same here:
math.h:extern const union __float_u __nanf;
math.h:#define NAN __nanf.__val

> I would guess that it's similar on mips. Is is possible that
> NetBSD/mips has a conversion bug?
>
> What I don't get is that the code I used in ECPG and in this
> test code is the same as in src/backend/utils/adt/float.c. E.g.:
> float8in sees "NaN" -> value will be (double)NAN
> float8out sees isnan(value) -> outputs "NaN" string
>
> Can someone shed some light on why the backend
> doesn't get the problem as above? :-(
>
> As Rémi says, isnan((double)(0.0 / 0.0)) == true for him.
> Michael: IIRC, IEEE754 explicit about that the (0.0/0.0) division
> produces NaN. How about doing it explicitely in ECPG?
>
> Rémi: please, run this code to confirm the above?
>

bash-4.1$ gcc -Wall -o nantest1 nantest1.c -lm
bash-4.1$ ./nantest1
computed NAN
1 0
defined INFINITY
0 1

Regards,

Rémi Zara


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Rémi Zara <remi_zara(at)mac(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-25 12:26:34
Message-ID: 4B866C7A.20403@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I wrote:
> As Rémi says, isnan((double)(0.0 / 0.0)) == true for him.
> Michael: IIRC, IEEE754 explicit about that the (0.0/0.0) division
> produces NaN. How about doing it explicitely in ECPG?
>

I came up with three patches, they are attached.

Can you try whether the first patch (missing float.h from data.c)
solves the problem? And together with the 2nd one? In that
patch I fixed the order of float.h and math.h in nan_test.pgc,
which is the opposite of the order found in e.g. backend/utils/adt/float.c.

The 3rd patch is explicit about NetBSD/mips but it doesn't feel right.

They are working on Linux/x86-64 and NetBSD/x86-64. Can you try
the combinations below on "pika" outside the buildfarm whether they
still fail the ECPG make check?
- patch 1 by itself (12a)
- patch 1+2 (12a + 12-regr)
- patch 3 with/without 1+2

Sorry to give you work, but we don't have a mips machine.

Thanks in advance,
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/

Attachment Content-Type Size
pg85-ecpg-fix-nan-inf-12a-ctxdiff.patch text/x-patch 322 bytes
pg85-ecpg-fix-nan-inf-12-regr-ctxdiff.patch text/x-patch 1.3 KB
pg85-ecpg-fix-nan-inf-12-ctxdiff.patch text/x-patch 540 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Rémi Zara <remi_zara(at)mac(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-25 15:37:59
Message-ID: 3885.1267112279@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
> Can you try whether the first patch (missing float.h from data.c)
> solves the problem? And together with the 2nd one? In that
> patch I fixed the order of float.h and math.h in nan_test.pgc,
> which is the opposite of the order found in e.g. backend/utils/adt/float.c.

> The 3rd patch is explicit about NetBSD/mips but it doesn't feel right.

The third patch is surely wrong. We don't need to do that in the
backend's instance of get_float8_nan, so ecpglib shouldn't need it
either.

I suspect that the ultimate cause of this is either one of the header
inclusion inconsistencies you found, or something associated with
not pulling in all the stuff that postgres.h does. port/netbsd.h
is empty though, so it's not immediately clear what might be missing.

regards, tom lane


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Rémi Zara <remi_zara(at)mac(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-26 11:12:10
Message-ID: 4B87AC8A.4020003@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane írta:
> Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
>
>> Can you try whether the first patch (missing float.h from data.c)
>> solves the problem? And together with the 2nd one? In that
>> patch I fixed the order of float.h and math.h in nan_test.pgc,
>> which is the opposite of the order found in e.g. backend/utils/adt/float.c.
>>
>
>
>> The 3rd patch is explicit about NetBSD/mips but it doesn't feel right.
>>
>
> The third patch is surely wrong. We don't need to do that in the
> backend's instance of get_float8_nan, so ecpglib shouldn't need it
> either.
>
> I suspect that the ultimate cause of this is either one of the header
> inclusion inconsistencies you found, or something associated with
> not pulling in all the stuff that postgres.h does. port/netbsd.h
> is empty though, so it's not immediately clear what might be missing.
>

ecpglib/data.c includes "postgres_fe.h", so it should be pulling
everything that's relevant from port/*, right?

Michael, can we try to install the first two patches?
They wouldn't hurt.

Thanks in advance,
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/


From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-26 12:47:26
Message-ID: F7DDC002-E59F-4551-BC95-7CB28F6B9EB4@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 26 févr. 2010 à 12:12, Boszormenyi Zoltan a écrit :

>
> ecpglib/data.c includes "postgres_fe.h", so it should be pulling
> everything that's relevant from port/*, right?
>
> Michael, can we try to install the first two patches?
> They wouldn't hurt.
>

I've tried patch 1 and 2, but they do not work. The fact is that the code is not used in the backend, because strtod("NaN", endptr) works. (isnan(strtod("NaN", endptr)) is true).

I should also note that isnan((double)nan("")) is true (works).

I will also report to NetBSD that isnan((double)NAN) does not work on mips.

Regards,

Rémi Zara


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>, Rémi Zara <remi_zara(at)mac(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-26 13:46:24
Message-ID: 20100226134624.GA12433@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Feb 26, 2010 at 12:12:10PM +0100, Boszormenyi Zoltan wrote:
> Michael, can we try to install the first two patches?

If I understood the rest of the thread correctly this is not needed anymore,
right?

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rémi Zara <remi_zara(at)mac(dot)com>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-26 16:11:31
Message-ID: 28428.1267200691@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?iso-8859-1?Q?R=E9mi_Zara?= <remi_zara(at)mac(dot)com> writes:
> I've tried patch 1 and 2, but they do not work. The fact is that the code is not used in the backend, because strtod("NaN", endptr) works. (isnan(strtod("NaN", endptr)) is true).

Hmm. So what do you get from
SELECT 'nan'::numeric::float8;
on that machine? That should exercise the backend's version of
get_float8_nan().

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Rémi Zara <remi_zara(at)mac(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-26 16:14:01
Message-ID: 28484.1267200841@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> On Fri, Feb 26, 2010 at 12:12:10PM +0100, Boszormenyi Zoltan wrote:
>> Michael, can we try to install the first two patches?

> If I understood the rest of the thread correctly this is not needed anymore,
> right?

I think it would be a good idea, just to have all that code using
identical #includes. Rmi's problem may be a platform bug rather
than something we can fix ourselves, but I think that making sure that
ecpg uses the exact same coding that's been proven in the backend
will forestall problems on other platforms.

regards, tom lane


From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-27 13:40:13
Message-ID: CAC0E717-9B5E-4261-AEC1-35C8BBA24E24@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 26 févr. 2010 à 17:11, Tom Lane a écrit :

> =?iso-8859-1?Q?R=E9mi_Zara?= <remi_zara(at)mac(dot)com> writes:
>> I've tried patch 1 and 2, but they do not work. The fact is that the code is not used in the backend, because strtod("NaN", endptr) works. (isnan(strtod("NaN", endptr)) is true).
>
> Hmm. So what do you get from
> SELECT 'nan'::numeric::float8;
> on that machine? That should exercise the backend's version of
> get_float8_nan().
>

regression=# select 'nan'::numeric::float8;
float8
----------
Infinity
(1 row)

So it is indeed the same behavior. Maybe that should be added to the regression tests.
So what's the best way to workaround the bug in NetBSD/mips ? (nan(""), (0.0/0.0), strtod("nan", null) ?)

Regards,

Rémi Zara


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rémi Zara <remi_zara(at)mac(dot)com>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-27 16:57:31
Message-ID: 26148.1267289851@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?iso-8859-1?Q?R=E9mi_Zara?= <remi_zara(at)mac(dot)com> writes:
> Le 26 fvr. 2010 17:11, Tom Lane a crit :
>> Hmm. So what do you get from
>> SELECT 'nan'::numeric::float8;

> regression=# select 'nan'::numeric::float8;
> float8
> ----------
> Infinity
> (1 row)

> So it is indeed the same behavior.

Yeah. So what it boils down to is that the platform has a NAN constant
but casting it to double produces the wrong thing. There's no doubt
that that's a bug in the floating-point support. You did say you'd
submitted it to the NetBSD folk right?

BTW, what about the float4 case, 'nan'::numeric::float4 ?

> Maybe that should be added to the regression tests.

Perhaps. A lot of this stuff was never stress-tested in the past
because when it was put in, it was a crap shoot whether NaN (or Inf)
really worked on most platforms. Our attitude was "if it works for you,
great, but we're not going to sweat about it if it doesn't". I'm not
sure whether full IEEE float support has gotten sufficiently universal
to justify expecting more. I guess we could try it and see how many
other buildfarm members fail.

> So what's the best way to workaround the bug in NetBSD/mips ?

I don't think it's our bug to fix.

regards, tom lane


From: Rémi Zara <remi_zara(at)mac(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-27 17:18:10
Message-ID: B3A3A907-830C-49FA-BB5B-D2DE18934603@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Le 27 févr. 2010 à 17:57, Tom Lane a écrit :

> =?iso-8859-1?Q?R=E9mi_Zara?= <remi_zara(at)mac(dot)com> writes:
>> Le 26 févr. 2010 à 17:11, Tom Lane a écrit :
>>> Hmm. So what do you get from
>>> SELECT 'nan'::numeric::float8;
>
>> regression=# select 'nan'::numeric::float8;
>> float8
>> ----------
>> Infinity
>> (1 row)
>
>> So it is indeed the same behavior.
>
> Yeah. So what it boils down to is that the platform has a NAN constant
> but casting it to double produces the wrong thing. There's no doubt
> that that's a bug in the floating-point support. You did say you'd
> submitted it to the NetBSD folk right?
>

I submitted it.

> BTW, what about the float4 case, 'nan'::numeric::float4 ?

That works OK.

>
>> Maybe that should be added to the regression tests.
>
> Perhaps. A lot of this stuff was never stress-tested in the past
> because when it was put in, it was a crap shoot whether NaN (or Inf)
> really worked on most platforms. Our attitude was "if it works for you,
> great, but we're not going to sweat about it if it doesn't". I'm not
> sure whether full IEEE float support has gotten sufficiently universal
> to justify expecting more. I guess we could try it and see how many
> other buildfarm members fail.
>
>> So what's the best way to workaround the bug in NetBSD/mips ?
>
> I don't think it's our bug to fix.
>

It would mean retiring pika until/if the bug is fixed... :-(

Regards,

Rémi Zara


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rémi Zara <remi_zara(at)mac(dot)com>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-27 20:50:23
Message-ID: 29708.1267303823@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?iso-8859-1?Q?R=E9mi_Zara?= <remi_zara(at)mac(dot)com> writes:
> Le 27 fvr. 2010 17:57, Tom Lane a crit :
>> I don't think it's our bug to fix.

> It would mean retiring pika until/if the bug is fixed... :-(

Grumble ... well, I suppose we've put in worse platform-specific hacks
elsewhere. At least this is pretty localized.

regards, tom lane


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Rémi Zara <remi_zara(at)mac(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NaN/Inf fix for ECPG
Date: 2010-02-27 21:56:02
Message-ID: 20100227215602.GB22113@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Feb 26, 2010 at 11:14:01AM -0500, Tom Lane wrote:
> I think it would be a good idea, just to have all that code using
> identical #includes. Rmi's problem may be a platform bug rather

Sounds reasonable, done.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL