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.As a side note,could float4in not be refactored to just call float8in followed by CheckFloat4Val and maybe some error message changes?
The two functions have a lot of duplicated code. IRIX 6.5.22m uname -R = 6.5 6.5.22m
Index: backend/utils/adt/float.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/float.c,v retrieving revision 1.128 diff -c -w -r1.128 float.c *** backend/utils/adt/float.c 28 Jul 2006 18:33:04 -0000 1.128 --- backend/utils/adt/float.c 30 Sep 2006 23:38:17 -0000 *************** *** 326,331 **** --- 326,343 ---- endptr--; } #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ + if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 && + (pg_strncasecmp(num,"infinity",8)==0 || + pg_strncasecmp(num,"-infinity",9)==0 ) ) + { + /** + * + * Some versions of strtod (IRIX) stop + * parsing after "inf" and leave endptr as inity + */ + endptr+=5; + } + /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) *************** *** 342,349 **** * if we get here, we have a legal double, still need to check to see if * it's a legal float4 */ ! if (!isinf(val)) CheckFloat4Val(val); PG_RETURN_FLOAT4((float4) val); } --- 354,373 ---- * if we get here, we have a legal double, still need to check to see if * it's a legal float4 */ ! if (!isinf(val)) { CheckFloat4Val(val); + } + else { + /** + * If val is infinity, make sure that -infinity + * was not asked for. Some implementations of strtod + * return inf when passed -inf + */ + if(pg_strncasecmp(num,"-Infinity",9)==0 || + pg_strncasecmp(num,"-Inf",5)==0) { + val = -get_float4_infinity(); + } + } PG_RETURN_FLOAT4((float4) val); } *************** *** 493,498 **** --- 517,533 ---- endptr--; } #endif /* HAVE_BUGGY_SOLARIS_STRTOD */ + if(endptr != num && pg_strncasecmp(endptr,"inity",5)==0 && + (pg_strncasecmp(num,"infinity",8)==0 || + pg_strncasecmp(num,"-infinity",9)==0 ) ) + { + /** + * + * Some versions of strtod (IRIX) stop + * parsing after "inf" and leave endptr as inity + */ + endptr+=5; + } /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) *************** *** 507,513 **** if (!isinf(val)) CheckFloat8Val(val); ! PG_RETURN_FLOAT8(val); } --- 542,558 ---- if (!isinf(val)) CheckFloat8Val(val); ! else { ! /** ! * If val is infinity, make sure that -infinity ! * was not asked for. Some implementations of strtod ! * return inf when passed -inf ! */ ! if(pg_strncasecmp(num,"-Infinity",9)==0 || ! pg_strncasecmp(num,"-Inf",5)==0) { ! val = -get_float4_infinity(); ! } ! } PG_RETURN_FLOAT8(val); }
*** ./expected/float4.out Wed Apr 6 21:51:40 2005 --- ./results/float4.out Sat Sep 30 19:46:24 2006 *************** *** 53,69 **** (1 row) SELECT 'infinity'::float4; ! float4 ! ---------- ! Infinity ! (1 row) ! SELECT ' -INFINiTY '::float4; ! float4 ! ----------- ! -Infinity ! (1 row) ! -- bad special inputs SELECT 'N A N'::float4; ERROR: invalid input syntax for type real: "N A N" --- 53,61 ---- (1 row) SELECT 'infinity'::float4; ! ERROR: invalid input syntax for type real: "infinity" SELECT ' -INFINiTY '::float4; ! ERROR: invalid input syntax for type real: " -INFINiTY " -- bad special inputs SELECT 'N A N'::float4; ERROR: invalid input syntax for type real: "N A N" *************** *** 72,84 **** SELECT ' INFINITY x'::float4; ERROR: invalid input syntax for type real: " INFINITY x" SELECT 'Infinity'::float4 + 100.0; ! ERROR: type "double precision" value out of range: overflow SELECT 'Infinity'::float4 / 'Infinity'::float4; ! ?column? ! ---------- ! NaN ! (1 row) ! SELECT 'nan'::float4 / 'nan'::float4; ?column? ---------- --- 64,72 ---- SELECT ' INFINITY x'::float4; ERROR: invalid input syntax for type real: " INFINITY x" SELECT 'Infinity'::float4 + 100.0; ! ERROR: invalid input syntax for type real: "Infinity" SELECT 'Infinity'::float4 / 'Infinity'::float4; ! ERROR: invalid input syntax for type real: "Infinity" SELECT 'nan'::float4 / 'nan'::float4; ?column? ---------- ====================================================================== *** ./expected/float8.out Wed Jun 8 17:15:29 2005 --- ./results/float8.out Sat Sep 30 19:46:24 2006 *************** *** 53,69 **** (1 row) SELECT 'infinity'::float8; ! float8 ! ---------- ! Infinity ! (1 row) ! SELECT ' -INFINiTY '::float8; ! float8 ! ----------- ! -Infinity ! (1 row) ! -- bad special inputs SELECT 'N A N'::float8; ERROR: invalid input syntax for type double precision: "N A N" --- 53,61 ---- (1 row) SELECT 'infinity'::float8; ! ERROR: invalid input syntax for type double precision: "infinity" SELECT ' -INFINiTY '::float8; ! ERROR: invalid input syntax for type double precision: " -INFINiTY " -- bad special inputs SELECT 'N A N'::float8; ERROR: invalid input syntax for type double precision: "N A N" *************** *** 72,84 **** SELECT ' INFINITY x'::float8; ERROR: invalid input syntax for type double precision: " INFINITY x" SELECT 'Infinity'::float8 + 100.0; ! ERROR: type "double precision" value out of range: overflow SELECT 'Infinity'::float8 / 'Infinity'::float8; ! ?column? ! ---------- ! NaN ! (1 row) ! SELECT 'nan'::float8 / 'nan'::float8; ?column? ---------- --- 64,72 ---- SELECT ' INFINITY x'::float8; ERROR: invalid input syntax for type double precision: " INFINITY x" SELECT 'Infinity'::float8 + 100.0; ! ERROR: invalid input syntax for type double precision: "Infinity" SELECT 'Infinity'::float8 / 'Infinity'::float8; ! ERROR: invalid input syntax for type double precision: "Infinity" SELECT 'nan'::float8 / 'nan'::float8; ?column? ---------- ====================================================================== *** ./expected/geometry_2.out Sat Sep 9 20:29:35 2006 --- ./results/geometry.out Sat Sep 30 19:46:34 2006 *************** *** 228,237 **** FROM BOX_TBL b, POINT_TBL p; twentyfour | rotation ------------+----------------------------- ! | (0,0),(0,0) ! | (0,0),(0,0) ! | (0,0),(0,0) ! | (0,0),(0,0) | (-0,0),(-20,-20) | (-10,-10),(-30,-30) | (-25,-25),(-25,-35) --- 228,237 ---- FROM BOX_TBL b, POINT_TBL p; twentyfour | rotation ------------+----------------------------- ! | (-0,0),(-0,0) ! | (-0,0),(-0,0) ! | (-0,0),(-0,0) ! | (-0,0),(-0,0) | (-0,0),(-20,-20) | (-10,-10),(-30,-30) | (-25,-25),(-25,-35) *************** *** 240,257 **** | (-7,3),(-21,1) | (-17.5,2.5),(-21.5,-0.5) | (-21,3),(-21,3) ! | (0,79.2),(-58.8,0) | (-29.4,118.8),(-88.2,39.6) | (-73.5,104.1),(-108,99) | (-88.2,118.8),(-88.2,118.8) ! | (14,-0),(0,-34) | (21,-17),(7,-51) | (29.5,-42.5),(17.5,-47.5) | (21,-51),(21,-51) ! | (0,40),(0,0) ! | (0,60),(0,20) ! | (0,60),(-10,50) ! | (0,60),(0,60) (24 rows) SELECT '' AS twenty, b.f1 / p.f1 AS rotation --- 240,257 ---- | (-7,3),(-21,1) | (-17.5,2.5),(-21.5,-0.5) | (-21,3),(-21,3) ! | (-0,79.2),(-58.8,0) | (-29.4,118.8),(-88.2,39.6) | (-73.5,104.1),(-108,99) | (-88.2,118.8),(-88.2,118.8) ! | (14,-0),(-0,-34) | (21,-17),(7,-51) | (29.5,-42.5),(17.5,-47.5) | (21,-51),(21,-51) ! | (-0,40),(-0,0) ! | (-0,60),(-0,20) ! | (-0,60),(-10,50) ! | (-0,60),(-0,60) (24 rows) SELECT '' AS twenty, b.f1 / p.f1 AS rotation *************** *** 267,284 **** | (0.12,-0.28),(0.04,-0.84) | (0.26,-0.7),(0.1,-0.82) | (0.12,-0.84),(0.12,-0.84) ! | (0.0651176557644,0),(0,-0.0483449262493) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374) ! | (-0,0.0828402366864),(-0.201183431953,0) | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432) | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414) | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503) ! | (0.2,0),(0,0) ! | (0.3,0),(0.1,0) ! | (0.3,0.05),(0.25,0) ! | (0.3,0),(0.3,0) (20 rows) -- --- 267,284 ---- | (0.12,-0.28),(0.04,-0.84) | (0.26,-0.7),(0.1,-0.82) | (0.12,-0.84),(0.12,-0.84) ! | (0.0651176557644,-0),(0,-0.0483449262493) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374) ! | (-0,0.0828402366864),(-0.201183431953,-0) | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432) | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414) | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503) ! | (0.2,-0),(0,-0) ! | (0.3,-0),(0.1,-0) ! | (0.3,0.05),(0.25,-0) ! | (0.3,-0),(0.3,-0) (20 rows) -- ======================================================================
parallel group (13 tests): text oid char float4 int8 name varchar int2 float8 boolean int4 bit numeric boolean ... ok char ... ok name ... ok varchar ... ok text ... ok int2 ... ok int4 ... ok int8 ... ok oid ... ok float4 ... FAILED float8 ... FAILED bit ... ok numeric ... ok test strings ... ok test numerology ... ok parallel group (20 tests): path lseg comments time circle polygon box timetz tinterval reltime abstime point interval inet timestamptz date timestamp type_sanity oidjoins opr_sanity point ... ok lseg ... ok box ... ok path ... ok polygon ... ok circle ... ok date ... ok time ... ok timetz ... ok timestamp ... ok timestamptz ... ok interval ... ok abstime ... ok reltime ... ok tinterval ... ok inet ... ok comments ... ok oidjoins ... ok type_sanity ... ok opr_sanity ... ok test geometry ... FAILED test horology ... ok test insert ... ok test create_function_1 ... ok test create_type ... ok test create_table ... ok test create_function_2 ... ok parallel group (2 tests): copyselect copy copy ... ok copyselect ... ok parallel group (8 tests): create_aggregate create_operator drop_if_exists vacuum constraints triggers create_misc inherit constraints ... ok triggers ... ok create_misc ... ok create_aggregate ... ok create_operator ... ok inherit ... ok vacuum ... ok drop_if_exists ... ok parallel group (2 tests): create_view create_index create_index ... ok create_view ... ok test sanity_check ... ok test errors ... ok test select ... ok parallel group (20 tests): select_distinct_on select_having select_into select_distinct btree_index random delete namespace update union case select_implicit hash_index aggregates portals arrays transactions join subselect prepared_xacts select_into ... ok select_distinct ... ok select_distinct_on ... ok select_implicit ... ok select_having ... ok subselect ... ok union ... ok case ... ok join ... ok aggregates ... ok transactions ... ok random ... ok portals ... ok arrays ... ok btree_index ... ok hash_index ... ok update ... ok namespace ... ok prepared_xacts ... ok delete ... ok test privileges ... ok test misc ... ok parallel group (7 tests): portals_p2 guc dependency cluster select_views rules foreign_key select_views ... ok portals_p2 ... ok rules ... ok foreign_key ... ok cluster ... ok dependency ... ok guc ... ok parallel group (15 tests): limit prepare copy2 polymorphism conversion temp sequence returning truncate without_oid rangefuncs domain plpgsql alter_table rowtypes limit ... ok plpgsql ... ok copy2 ... ok temp ... ok domain ... ok rangefuncs ... ok prepare ... ok without_oid ... ok conversion ... ok truncate ... ok alter_table ... ok sequence ... ok polymorphism ... ok rowtypes ... ok returning ... ok test stats ... ok test tablespace ... ok
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings