[postgis-tickets] r16637 - Adapt regress tests for parallel plans
Raul
raul at rmr.ninja
Fri Jul 6 06:14:06 PDT 2018
Author: algunenano
Date: 2018-07-06 06:14:06 -0700 (Fri, 06 Jul 2018)
New Revision: 16637
Modified:
trunk/raster/test/regress/rt_gdalwarp.sql
trunk/raster/test/regress/rt_setvalues_geomval.sql
trunk/regress/twkb.sql
trunk/topology/test/regress/st_remedgemodface.sql
trunk/topology/test/regress/st_remedgemodface_expected
trunk/topology/test/regress/st_remedgenewface.sql
trunk/topology/test/regress/st_remedgenewface_expected
Log:
Adapt regress tests for parallel plans
Closes #4117
Closes https://github.com/postgis/postgis/pull/266
Modified: trunk/raster/test/regress/rt_gdalwarp.sql
===================================================================
--- trunk/raster/test/regress/rt_gdalwarp.sql 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/raster/test/regress/rt_gdalwarp.sql 2018-07-06 13:14:06 UTC (rev 16637)
@@ -847,6 +847,7 @@
)
, 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
)
Modified: trunk/raster/test/regress/rt_setvalues_geomval.sql
===================================================================
--- trunk/raster/test/regress/rt_setvalues_geomval.sql 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/raster/test/regress/rt_setvalues_geomval.sql 2018-07-06 13:14:06 UTC (rev 16637)
@@ -9,6 +9,7 @@
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
Modified: trunk/regress/twkb.sql
===================================================================
--- trunk/regress/twkb.sql 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/regress/twkb.sql 2018-07-06 13:14:06 UTC (rev 16637)
@@ -48,6 +48,7 @@
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 @@
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
Modified: trunk/topology/test/regress/st_remedgemodface.sql
===================================================================
--- trunk/topology/test/regress/st_remedgemodface.sql 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/topology/test/regress/st_remedgemodface.sql 2018-07-06 13:14:06 UTC (rev 16637)
@@ -135,6 +135,20 @@
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 @@
-- 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 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;
Modified: trunk/topology/test/regress/st_remedgemodface_expected
===================================================================
--- trunk/topology/test/regress/st_remedgemodface_expected 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/topology/test/regress/st_remedgemodface_expected 2018-07-06 13:14:06 UTC (rev 16637)
@@ -199,7 +199,7 @@
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
Modified: trunk/topology/test/regress/st_remedgenewface.sql
===================================================================
--- trunk/topology/test/regress/st_remedgenewface.sql 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/topology/test/regress/st_remedgenewface.sql 2018-07-06 13:14:06 UTC (rev 16637)
@@ -135,6 +135,20 @@
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 @@
-- 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 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;
Modified: trunk/topology/test/regress/st_remedgenewface_expected
===================================================================
--- trunk/topology/test/regress/st_remedgenewface_expected 2018-07-06 11:21:59 UTC (rev 16636)
+++ trunk/topology/test/regress/st_remedgenewface_expected 2018-07-06 13:14:06 UTC (rev 16637)
@@ -229,7 +229,7 @@
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
More information about the postgis-tickets
mailing list