From: Raúl Marín Rodríguez Date: Fri, 6 Jul 2018 13:14:06 +0000 (+0000) Subject: Adapt regress tests for parallel plans X-Git-Tag: 2.5.0beta2~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=465236cb3cb5b38d1a5af5c34c3e94d0deb64f3e;p=postgis Adapt regress tests for parallel plans 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 --- diff --git a/raster/test/regress/rt_gdalwarp.sql b/raster/test/regress/rt_gdalwarp.sql index 22f6d9d03..2db51691f 100644 --- a/raster/test/regress/rt_gdalwarp.sql +++ b/raster/test/regress/rt_gdalwarp.sql @@ -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 ) diff --git a/raster/test/regress/rt_setvalues_geomval.sql b/raster/test/regress/rt_setvalues_geomval.sql index ac145e00e..c283a6926 100644 --- a/raster/test/regress/rt_setvalues_geomval.sql +++ b/raster/test/regress/rt_setvalues_geomval.sql @@ -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 diff --git a/regress/twkb.sql b/regress/twkb.sql index 8b0d5f2f3..916cd2c9f 100644 --- a/regress/twkb.sql +++ b/regress/twkb.sql @@ -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 diff --git a/topology/test/regress/st_remedgemodface.sql b/topology/test/regress/st_remedgemodface.sql index f32c675d5..9fb596198 100644 --- a/topology/test/regress/st_remedgemodface.sql +++ b/topology/test/regress/st_remedgemodface.sql @@ -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; diff --git a/topology/test/regress/st_remedgemodface_expected b/topology/test/regress/st_remedgemodface_expected index 410a10f45..c2531cfa0 100644 --- a/topology/test/regress/st_remedgemodface_expected +++ b/topology/test/regress/st_remedgemodface_expected @@ -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 diff --git a/topology/test/regress/st_remedgenewface.sql b/topology/test/regress/st_remedgenewface.sql index f1ecf07f1..ba7c10168 100644 --- a/topology/test/regress/st_remedgenewface.sql +++ b/topology/test/regress/st_remedgenewface.sql @@ -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; diff --git a/topology/test/regress/st_remedgenewface_expected b/topology/test/regress/st_remedgenewface_expected index 61d88d504..911c46bae 100644 --- a/topology/test/regress/st_remedgenewface_expected +++ b/topology/test/regress/st_remedgenewface_expected @@ -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