Unix Technical Forum

Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4

This is a discussion on Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4 within the pgsql Hackers forums, part of the PostgreSQL category; --> Chris Mair wrote: > The Playstation 2 hardware manuals confirm that the FPU has > no support for NaN ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:14 AM
Peter Eisentraut
 
Posts: n/a
Default Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4

Chris Mair wrote:
> The Playstation 2 hardware manuals confirm that the FPU has
> no support for NaN and +/-Inf. That explains the regression diffs.
> (EE Core User's Manual Version 5, p. 153)


Well, it does not readily explain that 'infinity' is rejected as invalid
input syntax. You should get an overflow or some large value, at
least.

The relevant code is in src/backend/utils/adt/float.c.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 03:14 AM
Tom Lane
 
Posts: n/a
Default Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4

Chris Mair <list@1006.org> writes:
> It seems strtod() is to blame.
> ...
> on the PlayStation 2 returns:


> input string is 'Infinity'
> strtod returned val = inf
> errno = 0
> endptr points to 'inity'


> Would it be worth treating this case apart in float.c, or should we just
> blame the PlayStation's 2 Linux (quite old version 2.2.2) Gnu C library
> to be broken?


I'd just say that that version of glibc is broken. I have not seen this
behavior reported anywhere else.

In any case, I think we can update the Playstation 2 entry for 8.0 ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 03:14 AM
Chris Mair
 
Posts: n/a
Default Re: [GENERAL] PostgreSQL 8.0.0 Release Candidate 4

On Sun, 2005-01-09 at 17:45, Peter Eisentraut wrote:

> Well, it does not readily explain that 'infinity' is rejected as invalid
> input syntax. You should get an overflow or some large value, at
> least.
>
> The relevant code is in src/backend/utils/adt/float.c.


You're right.
I had a look at the code.
It seems strtod() is to blame.

This sample program

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main()
{
char *endptr;
double val;
char *num = "Infinity";
errno = 0;
val = strtod(num, &endptr);
printf("input string is '%s'\n", num);
printf("strtod returned val = %lf\n", val);
printf("errno = %d\n", errno);
printf("endptr points to '%s'\n", endptr);
}

on the PlayStation 2 returns:

input string is 'Infinity'
strtod returned val = inf
errno = 0
endptr points to 'inity'

float.c's conversion routine cannot deal with a strtod that just eats
the 'Inf' part of 'Infinity', so the remaining 'inity' is causing the
syntax error (from line 522 in "float.c").

Consistently, this works with the so compiled version of PG:

postgres=# select 'Inf'::float8;
float8
----------
Infinity
(1 row)

Would it be worth treating this case apart in float.c, or should we just
blame the PlayStation's 2 Linux (quite old version 2.2.2) Gnu C library
to be broken?

I wonder how many implementations of strtod behave this way?
On a few other boxes of mine I've seen versions that accept 'Infinity'
as a whole or reject it as a whole


Bye, Chris.














---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:50 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com