Martin Münstermann <mmuenstermann@betrusted.com> writes:
> It's even a little more bizarre:
> When I start a fresh psql session, SELECT 'infinity'::float4 just works.
> Then I \i sql/float4.sql, and after that
> template1=# \set VERBOSITY verbose
> template1=# SELECT 'infinity'::float4;
> ERROR: 22P02: invalid input syntax for type real: "infinity"
> LOCATION: float4in, float.c:330
Wow. Well, that confirms my suspicion that endptr is bad --- the line
number shows that the complaint is coming from the
junk-at-end-of-the-string test. But why is it history-dependent?
I wonder if endptr might not be getting set at all in this case.
Could you try adding "endptr = num;" to the code in
src/backend/utils/adt/float.c, that is
/* skip leading whitespace */while (*num != '\0' && isspace((unsigned char) *num)) num++;
+ endptr = num;errno = 0;val = strtod(num, &endptr);
/* did we not see anything that looks like a double? */
at about line 280, and similarly at line 445. Does that make it
any better?
regards, tom lane