]> granicus.if.org Git - postgis/commitdiff
Adapt regress tests for parallel plans
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 6 Jul 2018 13:14:06 +0000 (13:14 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 6 Jul 2018 13:14:06 +0000 (13:14 +0000)
Closes #4117
Closes https://github.com/postgis/postgis/pull/266

git-svn-id: http://svn.osgeo.org/postgis/trunk@16637 b70326c6-7e19-0410-871a-916f4a2858ee

raster/test/regress/rt_gdalwarp.sql
raster/test/regress/rt_setvalues_geomval.sql
regress/twkb.sql
topology/test/regress/st_remedgemodface.sql
topology/test/regress/st_remedgemodface_expected
topology/test/regress/st_remedgenewface.sql
topology/test/regress/st_remedgenewface_expected

index 22f6d9d034cddcde794ab352243d0f92250fc252..2db51691f5d86f7e03d1937f5d58fcecdc33f6b8 100644 (file)
@@ -847,6 +847,7 @@ SELECT -- ticket #2188
                )
                , 0.5, 0.5
        ) AS rast
+ORDER BY rid -- Force order to get consistent results with parallel plans
 ), bar AS (
        SELECT rid, ST_Metadata(rast) AS meta, ST_SummaryStats(rast) AS stats FROM foo
 )
index ac145e00e1eaac40133f133b178f5d9b39fbb182..c283a69266e059a6000da26bbeed0f72f3bfe2ce 100644 (file)
@@ -9,6 +9,7 @@ CREATE TABLE raster_setvalues_geom AS
        SELECT 2 AS gid, 'SRID=0;POLYGON((1 -1, 4 -1, 4 -4, 1 -4, 1 -1))'::geometry geom UNION ALL
        SELECT 3 AS gid, 'SRID=0;POLYGON((0 0, 5 0, 5 -1, 1 -1, 1 -4, 0 -4, 0 0))'::geometry geom UNION ALL
        SELECT 4 AS gid, 'SRID=0;MULTIPOINT(0 0, 4 4, 4 -4)'::geometry
+        ORDER BY gid
 ;
 
 SELECT
index 8b0d5f2f31ef6148843e2b3f82b9b7e2593c7faf..916cd2c9fcd3151cb345d1f04f5e9dc55374eff9 100644 (file)
@@ -48,6 +48,7 @@ select st_astext(st_collect(g::geometry)), encode(ST_AsTWKB(ST_Collect(g::geomet
 select 'POINT(1 1)'::text g
 union all
 select 'LINESTRING(2 2, 3 3)'::text g
+order by g desc -- Force order to get consistent results with parallel plans
 ) foo;
 
 select st_astext(st_collect(g::geometry)), encode(ST_AsTWKB(ST_Collect(g::geometry),0),'hex') from
@@ -57,6 +58,7 @@ union all
 select 'POINT(78 -78)'::text g
 union all
 select 'POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))'::text g
+order by g -- Force order to get consistent results with parallel plans
 ) foo;
 
 --GEOMETRYCOLLECTION with bounding box ref #3187
index f32c675d53d5a5c755d2335920bcc68bd0108802..9fb5961987cbb8afdb92c6c556b4715e1f0bff9f 100644 (file)
@@ -135,6 +135,20 @@ BEGIN
 END
 $$ language 'plpgsql';
 
+-- Runs a query and returns whether an error was thrown
+-- Useful when the error message depends on the execution plan taken (parallelism)
+CREATE OR REPLACE FUNCTION catch_error(query text)
+RETURNS bool
+AS $$
+BEGIN
+    EXECUTE query;
+    RETURN FALSE;
+EXCEPTION
+    WHEN OTHERS THEN
+        RETURN TRUE;
+END
+$$ LANGUAGE 'plpgsql';
+
 -- }
 
 -- Save current state
@@ -376,7 +390,7 @@ SELECT '*RM(5)', topology.ST_RemEdgeModFace('city_data', 5);
 -- Two land_parcels (P2 and P3) are defined by either face
 -- 5 but not face 4 or by face 4 but not face 5, so we can't heal
 -- the faces by dropping edge 17
-SELECT '*RM(17)', topology.ST_RemEdgeModFace('city_data', 17);
+SELECT '*RM(17)', catch_error($$SELECT topology.ST_RemEdgeModFace('city_data', 17)$$);
 
 -- Dropping edge 11 is fine as it heals faces 5 and 8, which
 -- only serve definition of land_parcel P3 which contains both
@@ -409,5 +423,6 @@ DROP FUNCTION save_faces();
 DROP FUNCTION check_faces(text);
 DROP FUNCTION save_nodes();
 DROP FUNCTION check_nodes(text);
+DROP FUNCTION catch_error(text);
 DELETE FROM spatial_ref_sys where srid = 4326;
 
index 410a10f4566c5bf0ca7842cec49fd2a12bc4bc06..c2531cfa0717dd7036003411a5b56a363772deaf 100644 (file)
@@ -199,7 +199,7 @@ features.traffic_signs.the_geom SRID:0 TYPE:MULTIPOINT DIMS:2
 ERROR:  TopoGeom 4 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 3
 ERROR:  TopoGeom 2 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 4
 ERROR:  TopoGeom 2 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 5
-ERROR:  TopoGeom 2 in layer 1 (features.land_parcels.feature) cannot be represented healing faces 5 and 4
+*RM(17)|t
 RM(11)|relations_before:|18
 RM(11)|8
 RM(11)|relations_after:|17
index f1ecf07f16f1a97fb3d8783811d0e018c2efd24f..ba7c101681b2a2622a9aa5db588db5d0134189de 100644 (file)
@@ -135,6 +135,20 @@ BEGIN
 END
 $$ language 'plpgsql';
 
+-- Runs a query and returns whether an error was thrown
+-- Useful when the error message depends on the execution plan taken (parallelism)
+CREATE OR REPLACE FUNCTION catch_error(query text)
+RETURNS bool
+AS $$
+BEGIN
+    EXECUTE query;
+    RETURN FALSE;
+EXCEPTION
+    WHEN OTHERS THEN
+        RETURN TRUE;
+END
+$$ LANGUAGE 'plpgsql';
+
 -- }
 
 -- Save current state
@@ -376,7 +390,7 @@ SELECT '*RN(5)', topology.ST_RemEdgeNewFace('city_data', 5);
 -- Two land_parcels (P2 and P3) are defined by either face
 -- 5 but not face 4 or by face 4 but not face 5, so we can't heal
 -- the faces by dropping edge 17
-SELECT '*RN(17)', topology.ST_RemEdgeNewFace('city_data', 17);
+SELECT '*RN(17)', catch_error($$SELECT topology.ST_RemEdgeNewFace('city_data', 17)$$);
 
 -- Dropping edge 11 is fine as it heals faces 5 and 8, which
 -- only serve definition of land_parcel P3 which contains both
@@ -409,5 +423,6 @@ DROP FUNCTION save_faces();
 DROP FUNCTION check_faces(text);
 DROP FUNCTION save_nodes();
 DROP FUNCTION check_nodes(text);
+DROP FUNCTION catch_error(text);
 DELETE FROM spatial_ref_sys where srid = 4326;
 
index 61d88d5040b5c3ae19ade20ab1478180cfc1937b..911c46bae4cc9b5157eab37bd96d1cd7b4262bdb 100644 (file)
@@ -229,7 +229,7 @@ features.traffic_signs.the_geom SRID:0 TYPE:MULTIPOINT DIMS:2
 ERROR:  TopoGeom 4 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 3
 ERROR:  TopoGeom 2 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 4
 ERROR:  TopoGeom 2 in layer 3 (features.city_streets.feature) cannot be represented dropping edge 5
-ERROR:  TopoGeom 2 in layer 1 (features.land_parcels.feature) cannot be represented healing faces 5 and 4
+*RN(17)|t
 RN(11)|relations_before:|18
 RN(11)|10
 RN(11)|relations_after:|17