Avoid using platform-dependent floats in test case.
authorHeikki Linnakangas <[email protected]>
Wed, 26 Oct 2016 11:17:07 +0000 (14:17 +0300)
committerHeikki Linnakangas <[email protected]>
Wed, 26 Oct 2016 11:17:07 +0000 (14:17 +0300)
The number of decimals printed for floats varied in this test case, as
noted by several buildfarm members. There's nothing special about floats
and arrays in the code being tested, so replace the floats with numerics to
make the output platform-independent.

src/pl/plpython/expected/plpython_types.out
src/pl/plpython/expected/plpython_types_3.out
src/pl/plpython/sql/plpython_types.sql

index 5243aab54836d0c9ba897dff08e18b6867d9ca77..c53f240c0bed6099413432a0db4ac84e164e9b30 100644 (file)
@@ -568,24 +568,13 @@ INFO:  ([[[1L, 2L, None], [None, 5L, 6L]], [[None, 8L, 9L], [10L, 11L, 12L]]], <
  {{{1,2,NULL},{NULL,5,6}},{{NULL,8,9},{10,11,12}}}
 (1 row)
 
-CREATE FUNCTION test_type_conversion_array_float4(x float4[]) RETURNS float4[] AS $$
+CREATE FUNCTION test_type_conversion_array_numeric(x numeric[]) RETURNS numeric[] AS $$
 plpy.info(x, type(x))
 return x
 $$ LANGUAGE plpythonu;
-SELECT * FROM test_type_conversion_array_float4(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float4[]);
-INFO:  ([[[1.2000000476837158, 2.299999952316284, None], [None, 5.699999809265137, 6.800000190734863]], [[None, 8.899999618530273, 9.345000267028809], [10.123000144958496, 11.456000328063965, 12.676799774169922]]], <type 'list'>)
-                      test_type_conversion_array_float4                       
-------------------------------------------------------------------------------
- {{{1.2,2.3,NULL},{NULL,5.7,6.8}},{{NULL,8.9,9.345},{10.123,11.456,12.6768}}}
-(1 row)
-
-CREATE FUNCTION test_type_conversion_array_float8(x float8[]) RETURNS float8[] AS $$
-plpy.info(x, type(x))
-return x
-$$ LANGUAGE plpythonu;
-SELECT * FROM test_type_conversion_array_float8(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float8[]);
-INFO:  ([[[1.2, 2.3, None], [None, 5.7, 6.8]], [[None, 8.9, 9.345], [10.123, 11.456, 12.6768]]], <type 'list'>)
-                      test_type_conversion_array_float8                       
+SELECT * FROM test_type_conversion_array_numeric(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::numeric[]);
+INFO:  ([[[Decimal('1.2'), Decimal('2.3'), None], [None, Decimal('5.7'), Decimal('6.8')]], [[None, Decimal('8.9'), Decimal('9.345')], [Decimal('10.123'), Decimal('11.456'), Decimal('12.6768')]]], <type 'list'>)
+                      test_type_conversion_array_numeric                      
 ------------------------------------------------------------------------------
  {{{1.2,2.3,NULL},{NULL,5.7,6.8}},{{NULL,8.9,9.345},{10.123,11.456,12.6768}}}
 (1 row)
index 1592219522f7126ee0994c46eb4418ecd2ff578c..6a2955b0acd5205fdee191a7710eaedc9b708130 100644 (file)
@@ -568,24 +568,13 @@ INFO:  ([[[1, 2, None], [None, 5, 6]], [[None, 8, 9], [10, 11, 12]]], <class 'li
  {{{1,2,NULL},{NULL,5,6}},{{NULL,8,9},{10,11,12}}}
 (1 row)
 
-CREATE FUNCTION test_type_conversion_array_float4(x float4[]) RETURNS float4[] AS $$
+CREATE FUNCTION test_type_conversion_array_numeric(x numeric[]) RETURNS numeric[] AS $$
 plpy.info(x, type(x))
 return x
 $$ LANGUAGE plpython3u;
-SELECT * FROM test_type_conversion_array_float4(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float4[]);
-INFO:  ([[[1.2000000476837158, 2.299999952316284, None], [None, 5.699999809265137, 6.800000190734863]], [[None, 8.899999618530273, 9.345000267028809], [10.123000144958496, 11.456000328063965, 12.676799774169922]]], <class 'list'>)
-                      test_type_conversion_array_float4                       
-------------------------------------------------------------------------------
- {{{1.2,2.3,NULL},{NULL,5.7,6.8}},{{NULL,8.9,9.345},{10.123,11.456,12.6768}}}
-(1 row)
-
-CREATE FUNCTION test_type_conversion_array_float8(x float8[]) RETURNS float8[] AS $$
-plpy.info(x, type(x))
-return x
-$$ LANGUAGE plpython3u;
-SELECT * FROM test_type_conversion_array_float8(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float8[]);
-INFO:  ([[[1.2, 2.3, None], [None, 5.7, 6.8]], [[None, 8.9, 9.345], [10.123, 11.456, 12.6768]]], <class 'list'>)
-                      test_type_conversion_array_float8                       
+SELECT * FROM test_type_conversion_array_numeric(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::numeric[]);
+INFO:  ([[[Decimal('1.2'), Decimal('2.3'), None], [None, Decimal('5.7'), Decimal('6.8')]], [[None, Decimal('8.9'), Decimal('9.345')], [Decimal('10.123'), Decimal('11.456'), Decimal('12.6768')]]], <class 'list'>)
+                      test_type_conversion_array_numeric                      
 ------------------------------------------------------------------------------
  {{{1.2,2.3,NULL},{NULL,5.7,6.8}},{{NULL,8.9,9.345},{10.123,11.456,12.6768}}}
 (1 row)
index 802dd4104a6b1fecff40b9297ba3011b05018e4a..41a70dea513cc681484ead3ca3f0cce3c3327d3d 100644 (file)
@@ -247,19 +247,12 @@ $$ LANGUAGE plpythonu;
 
 SELECT * FROM test_type_conversion_array_int8(ARRAY[[[1,2,NULL],[NULL,5,6]],[[NULL,8,9],[10,11,12]]]::int8[]);
 
-CREATE FUNCTION test_type_conversion_array_float4(x float4[]) RETURNS float4[] AS $$
+CREATE FUNCTION test_type_conversion_array_numeric(x numeric[]) RETURNS numeric[] AS $$
 plpy.info(x, type(x))
 return x
 $$ LANGUAGE plpythonu;
 
-SELECT * FROM test_type_conversion_array_float4(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float4[]);
-
-CREATE FUNCTION test_type_conversion_array_float8(x float8[]) RETURNS float8[] AS $$
-plpy.info(x, type(x))
-return x
-$$ LANGUAGE plpythonu;
-
-SELECT * FROM test_type_conversion_array_float8(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::float8[]);
+SELECT * FROM test_type_conversion_array_numeric(ARRAY[[[1.2,2.3,NULL],[NULL,5.7,6.8]],[[NULL,8.9,9.345],[10.123,11.456,12.6768]]]::numeric[]);
 
 CREATE FUNCTION test_type_conversion_array_date(x date[]) RETURNS date[] AS $$
 plpy.info(x, type(x))