)
, 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
)
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
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
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
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
-- 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
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;
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
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
-- 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
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;
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