vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| ssinger_pg@sympatico.ca writes: > I'm getting some failures in the regression tests on 8.2beta1 on IRIX. > It looks like IRIX (or at least some versions) has a broken strtod. > The float4 and float8 tests fail, I've attached a patch to > tools/adt/float.c that fixes the problem along with the regression output. That patch is pretty seriously broken (not only because it's not ifdef'd to apply only on the platform that needs it, but because it'll do the wrong thing with "infinityinity"). But what I'm really wondering is why we've not heard of this before? That code hasn't been changed in quite some time. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| Steve Singer <ssinger_pg@sympatico.ca> writes: > Some searching of the net shows that this has been reported before. Once in > the beta for 8.1 and again in January as bug #2192 (It looks like a patch > was included then but wasn't applied). Yeah, I see that, not sure why we didn't apply that patch. Will work on this. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| |||
| I've applied the attached patch which merges ideas from your version and John Jorgensen's. Please check it. regards, tom lane *** src/backend/utils/adt/float.c.orig Tue Oct 3 23:16:36 2006 --- src/backend/utils/adt/float.c Wed Oct 4 21:21:17 2006 *************** *** 328,333 **** --- 328,359 ---- } #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ + #ifdef HAVE_BUGGY_IRIX_STRTOD + /* + * In some IRIX versions, strtod() recognizes only "inf", so if the + * input is "infinity" we have to skip over "inity". Also, it may + * return positive infinity for "-inf". + */ + if (isinf(val)) + { + if (pg_strncasecmp(num, "Infinity", 8) == 0) + { + val = get_float4_infinity(); + endptr = num + 8; + } + else if (pg_strncasecmp(num, "-Infinity", 9) == 0) + { + val = -get_float4_infinity(); + endptr = num + 9; + } + else if (pg_strncasecmp(num, "-inf", 4) == 0) + { + val = -get_float4_infinity(); + endptr = num + 4; + } + } + #endif /* HAVE_BUGGY_IRIX_STRTOD */ + /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) endptr++; *************** *** 494,499 **** --- 520,551 ---- endptr--; } #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ + + #ifdef HAVE_BUGGY_IRIX_STRTOD + /* + * In some IRIX versions, strtod() recognizes only "inf", so if the + * input is "infinity" we have to skip over "inity". Also, it may + * return positive infinity for "-inf". + */ + if (isinf(val)) + { + if (pg_strncasecmp(num, "Infinity", 8) == 0) + { + val = get_float8_infinity(); + endptr = num + 8; + } + else if (pg_strncasecmp(num, "-Infinity", 9) == 0) + { + val = -get_float8_infinity(); + endptr = num + 9; + } + else if (pg_strncasecmp(num, "-inf", 4) == 0) + { + val = -get_float8_infinity(); + endptr = num + 4; + } + } + #endif /* HAVE_BUGGY_IRIX_STRTOD */ /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) *** src/include/port/irix.h.orig Fri Mar 10 23:38:38 2006 --- src/include/port/irix.h Wed Oct 4 21:20:50 2006 *************** *** 1 **** --- 1,7 ---- /* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */ + + /* + * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts + * "infinity", but leaves endptr pointing to "inity". + */ + #define HAVE_BUGGY_IRIX_STRTOD ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| ||||
| On Wed, 4 Oct 2006, Tom Lane wrote: I've applied the patch and it seems to fix the problems. 8.2beta1 + the patch passes all of the regression tests on the IRIX box (accept the expected difference with the geometry test). > I've applied the attached patch which merges ideas from your version and > John Jorgensen's. Please check it. > > regards, tom lane > > *** src/backend/utils/adt/float.c.orig Tue Oct 3 23:16:36 2006 > --- src/backend/utils/adt/float.c Wed Oct 4 21:21:17 2006 > *************** > *** 328,333 **** > --- 328,359 ---- > } > #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ > > + #ifdef HAVE_BUGGY_IRIX_STRTOD > + /* > + * In some IRIX versions, strtod() recognizes only "inf", so if the > + * input is "infinity" we have to skip over "inity". Also, it may > + * return positive infinity for "-inf". > + */ > + if (isinf(val)) > + { > + if (pg_strncasecmp(num, "Infinity", 8) == 0) > + { > + val = get_float4_infinity(); > + endptr = num + 8; > + } > + else if (pg_strncasecmp(num, "-Infinity", 9) == 0) > + { > + val = -get_float4_infinity(); > + endptr = num + 9; > + } > + else if (pg_strncasecmp(num, "-inf", 4) == 0) > + { > + val = -get_float4_infinity(); > + endptr = num + 4; > + } > + } > + #endif /* HAVE_BUGGY_IRIX_STRTOD */ > + > /* skip trailing whitespace */ > while (*endptr != '\0' && isspace((unsigned char) *endptr)) > endptr++; > *************** > *** 494,499 **** > --- 520,551 ---- > endptr--; > } > #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ > + > + #ifdef HAVE_BUGGY_IRIX_STRTOD > + /* > + * In some IRIX versions, strtod() recognizes only "inf", so if the > + * input is "infinity" we have to skip over "inity". Also, it may > + * return positive infinity for "-inf". > + */ > + if (isinf(val)) > + { > + if (pg_strncasecmp(num, "Infinity", 8) == 0) > + { > + val = get_float8_infinity(); > + endptr = num + 8; > + } > + else if (pg_strncasecmp(num, "-Infinity", 9) == 0) > + { > + val = -get_float8_infinity(); > + endptr = num + 9; > + } > + else if (pg_strncasecmp(num, "-inf", 4) == 0) > + { > + val = -get_float8_infinity(); > + endptr = num + 4; > + } > + } > + #endif /* HAVE_BUGGY_IRIX_STRTOD */ > > /* skip trailing whitespace */ > while (*endptr != '\0' && isspace((unsigned char) *endptr)) > *** src/include/port/irix.h.orig Fri Mar 10 23:38:38 2006 > --- src/include/port/irix.h Wed Oct 4 21:20:50 2006 > *************** > *** 1 **** > --- 1,7 ---- > /* $PostgreSQL: pgsql/src/include/port/irix.h,v 1.3 2006/03/11 04:38:38 momjian Exp $ */ > + > + /* > + * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts > + * "infinity", but leaves endptr pointing to "inity". > + */ > + #define HAVE_BUGGY_IRIX_STRTOD > ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |