File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.106 2004/08/04 21:34:02 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.107 2004/08/11 17:20:49 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -317,6 +317,18 @@ float4in(PG_FUNCTION_ARGS)
317317 errmsg ("invalid input syntax for type real: \"%s\"" ,
318318 orig_num )));
319319 }
320+ #ifdef HAVE_BUGGY_SOLARIS_STRTOD
321+ else
322+ {
323+ /*
324+ * Many versions of Solaris have a bug wherein strtod sets endptr
325+ * to point one byte beyond the end of the string when given
326+ * "inf" or "infinity".
327+ */
328+ if (endptr != num && endptr [-1 ] == '\0' )
329+ endptr -- ;
330+ }
331+ #endif /* HAVE_BUGGY_SOLARIS_STRTOD */
320332
321333 /* skip trailing whitespace */
322334 while (* endptr != '\0' && isspace ((unsigned char ) * endptr ))
@@ -482,6 +494,18 @@ float8in(PG_FUNCTION_ARGS)
482494 errmsg ("invalid input syntax for type double precision: \"%s\"" ,
483495 orig_num )));
484496 }
497+ #ifdef HAVE_BUGGY_SOLARIS_STRTOD
498+ else
499+ {
500+ /*
501+ * Many versions of Solaris have a bug wherein strtod sets endptr
502+ * to point one byte beyond the end of the string when given
503+ * "inf" or "infinity".
504+ */
505+ if (endptr != num && endptr [-1 ] == '\0' )
506+ endptr -- ;
507+ }
508+ #endif /* HAVE_BUGGY_SOLARIS_STRTOD */
485509
486510 /* skip trailing whitespace */
487511 while (* endptr != '\0' && isspace ((unsigned char ) * endptr ))
Original file line number Diff line number Diff line change 1- /* $PostgreSQL: pgsql/src/include/port/solaris.h,v 1.11 2004/03/15 03:29:22 tgl Exp $ */
1+ /* $PostgreSQL: pgsql/src/include/port/solaris.h,v 1.12 2004/08/11 17:20:50 tgl Exp $ */
22
33/*
44 * Sort this out for all operating systems some time. The __xxx
3535#define BYTE_ORDER LITTLE_ENDIAN
3636#endif
3737#endif
38+
39+ /*
40+ * Many versions of Solaris have broken strtod() --- see bug #4751182.
41+ * For the moment we just assume they all do; it's probably not worth
42+ * the trouble to add a configure test for this.
43+ */
44+ #define HAVE_BUGGY_SOLARIS_STRTOD
You can’t perform that action at this time.
0 commit comments