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

Reply via email to