From: Paul Ramsey Date: Mon, 24 Nov 2008 18:09:33 +0000 (+0000) Subject: Change to not use SELECT FROM VALUES form to avoid failures on pre-8.2 pgsql X-Git-Tag: 1.3.4~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6313ff7b9923e852b70ec42cef1dce4551163cc8;p=postgis Change to not use SELECT FROM VALUES form to avoid failures on pre-8.2 pgsql git-svn-id: http://svn.osgeo.org/postgis/branches/1.3@3327 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/regress/regress_ogc_prep.sql b/regress/regress_ogc_prep.sql index e4c64839f..a7f9c7071 100644 --- a/regress/regress_ogc_prep.sql +++ b/regress/regress_ogc_prep.sql @@ -3,296 +3,160 @@ --- --- -SELECT c, ST_Intersects(ply, pt) FROM -( VALUES --- PIP - point within polygon (no cache) -('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point within polygon -('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point on polygon vertex -('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), --- PIP - point outside polygon -('intersects102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'), --- PIP - point on polygon edge -('intersects103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'), --- PIP - point in line with polygon edge -('intersects104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)') -) AS v(c,ply,pt); - -SELECT c, ST_Contains(ply, pt) FROM -( VALUES --- PIP - point within polygon (no cache) -('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point within polygon -('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point on polygon vertex -('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), --- PIP - point outside polygon -('contains102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'), --- PIP - point on polygon edge -('contains103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'), --- PIP - point in line with polygon edge -('contains104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)') -) AS v(c,ply,pt); - -SELECT c, ST_Covers(ply, pt) FROM -( VALUES --- PIP - point within polygon (no cache) -('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point within polygon -('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), --- PIP - point on polygon vertex -('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), --- PIP - point outside polygon -('covers102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'), --- PIP - point on polygon edge -('covers103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'), --- PIP - point in line with polygon edge -('covers104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)') -) AS v(c,ply,pt); +CREATE TABLE ogc_prep ( + c VARCHAR, + g1 GEOMETRY, + g2 GEOMETRY +); -SELECT c, ST_ContainsProperly(ply, pt) FROM -( VALUES -- PIP - point within polygon (no cache) -('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); -- PIP - point within polygon -('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); -- PIP - point on polygon vertex -('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'); -- PIP - point outside polygon -('containsproperly102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'), +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'); -- PIP - point on polygon edge -('containsproperly103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'), +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'); -- PIP - point in line with polygon edge -('containsproperly104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)') -) AS v(c,ply,pt); - - --- PIP - point vertically aligned with polygon vertex, poly first -SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - point vertically aligned with polygon vertex, point first -SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, poly first -SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, point first -SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); - - --- PIP - point vertically aligned with polygon vertex, poly first -SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - point vertically aligned with polygon vertex, point first -SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)'); + +SELECT 'intersects' || c, ST_Intersects(g1, g2) FROM ogc_prep ORDER BY c; +SELECT 'contains' || c, ST_Contains(g1, g2) FROM ogc_prep ORDER BY c; +SELECT 'covers' || c, ST_Covers(g1, g2) FROM ogc_prep ORDER BY c; +SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep ORDER BY c; + +-- PIP - point vertically aligned with polygon vertex +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) ); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) ); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) ); -- PIP - repeated vertex, poly first -SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, point first -SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) ); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) ); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) ); -- PIP - point vertically aligned with polygon vertex, poly first -SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - point vertically aligned with polygon vertex, point first -SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, poly first -SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, point first -SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); +SELECT 'intersectspoly' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c = '105'; +SELECT 'intersectspoint' || c, ST_Intersects(g2, g1) FROM ogc_prep WHERE c = '105'; +SELECT 'containspoly' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c = '105'; +SELECT 'containspoint' || c, ST_Contains(g2, g1) FROM ogc_prep WHERE c = '105'; +SELECT 'containsproperlypoly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c = '105'; +SELECT 'containsproperlypoint' || c, ST_ContainsProperly(g2, g1) FROM ogc_prep WHERE c = '105'; +SELECT 'coverspoly' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c = '105'; +SELECT 'coverspoint' || c, ST_Covers(g2, g1) FROM ogc_prep WHERE c = '105'; + +SELECT 'intersectspoly' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c = '106'; +SELECT 'intersectspoint' || c, ST_Intersects(g2, g1) FROM ogc_prep WHERE c = '106'; +SELECT 'containspoly' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c = '106'; +SELECT 'containspoint' || c, ST_Contains(g2, g1) FROM ogc_prep WHERE c = '106'; +SELECT 'containsproperlypoly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c = '106'; +SELECT 'containsproperlypoint' || c, ST_ContainsProperly(g2, g1) FROM ogc_prep WHERE c = '106'; +SELECT 'coverspoly' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c = '106'; +SELECT 'coverspoint' || c, ST_Covers(g2, g1) FROM ogc_prep WHERE c = '106'; + + +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'); + +SELECT 'intersects' || c, ST_Intersects(g1, g2) AS intersects_g1g2, ST_Intersects(g2, g1) AS intersects_g2g1 + FROM ogc_prep WHERE c >= '200' ORDER BY c; +SELECT 'contains' || c, ST_Contains(g1, g2) AS contains_g1g2, ST_Contains(g2, g1) AS contains_g2g1 + FROM ogc_prep WHERE c >= '200' ORDER BY c; +SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) AS containsproperly_g1g2, ST_ContainsProperly(g2, g1) AS containsproperly_g2g1 + FROM ogc_prep WHERE c >= '200' ORDER BY c; +SELECT 'covers' || c, ST_Covers(g1, g2) AS covers_g1g2, ST_Covers(g2, g1) AS covers_g2g1 + FROM ogc_prep WHERE c >= '200' ORDER BY c; --- PIP - point vertically aligned with polygon vertex, poly first -SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - point vertically aligned with polygon vertex, point first -SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, poly first -SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); --- PIP - repeated vertex, point first -SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM -( VALUES - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)), - (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) -) AS v(p); -SELECT c, ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 FROM -( VALUES -('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('intersects202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('intersects204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'), -('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('intersects207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('intersects209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))') -) AS v(c,p1,p2); - -SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1 FROM -( VALUES -('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('contains202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('contains204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'), -('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('contains207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('contains209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))') -) AS v(c,p1,p2); - -SELECT c, ST_ContainsProperly(p1, p2) AS containsproperly_p1p2, ST_ContainsProperly(p2, p1) AS containsproperly_p2p1 FROM -( VALUES -('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('containsproperly202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('containsproperly204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'), -('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('containsproperly207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('containsproperly209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))') -) AS v(c,p1,p2); - -SELECT c, ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1 FROM -( VALUES -('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('covers202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('covers204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'), -('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), -('covers207', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'), -('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), -('covers209', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))') -) AS v(c,p1,p2); - -- UNEXPECTED GEOMETRY TYPES -- -SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1, - ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1, - ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1, - ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1 - FROM -( VALUES -('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), -('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), -('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), -('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), -('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), -('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), -('types106', 'POINT(5 5)', 'POINT(5 5)'), -('types107', 'POINT(5 5)', 'POINT(5 5)'), -('types108', 'POINT(5 5)', 'POINT(5 5)'), -('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), -('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), -('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), -('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), -('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), -('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)') -) AS v(c,p1,p2); - +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('300', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('301', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('302', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('303', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('304', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('305', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('306', 'POINT(5 5)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('307', 'POINT(5 5)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('308', 'POINT(5 5)', 'POINT(5 5)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('309', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('310', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('311', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('312', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('313', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ('314', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'); -SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)') -) AS v(p); -SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)') -) AS v(p); - -SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)') -) AS v(p); -SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)') -) AS v(p); - -SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)') -) AS v(p); -SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)') -) AS v(p); - -SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)') -) AS v(p); -SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES -('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)') -) AS v(p); +-- UNEXPECTED GEOMETRY TYPES -- +SELECT c, ST_Contains(g1, g2) AS contains_g1g2, ST_Contains(g2, g1) AS contains_g2g1, + ST_Covers(g1, g2) AS covers_g1g2, ST_Covers(g2, g1) AS covers_g2g1, + ST_Intersects(g1, g2) AS intersects_g1g2, ST_Intersects(g2, g1) AS intersects_g2g1, + ST_ContainsProperly(g1, g2) AS containsproper_g1g2, ST_ContainsProperly(g2, g1) AS containsproper_g2g1 + FROM ogc_prep WHERE c >= '300' ORDER BY c; + +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)'); +INSERT INTO ogc_prep (c, g1, g2) + VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)'); + +SELECT 'intersects' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c; +SELECT 'contains' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c; +SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c; +SELECT 'covers' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c; + +DROP TABLE ogc_prep; diff --git a/regress/regress_ogc_prep_expected b/regress/regress_ogc_prep_expected index 4600388de..6286ddbb6 100644 --- a/regress/regress_ogc_prep_expected +++ b/regress/regress_ogc_prep_expected @@ -22,54 +22,54 @@ containsproperly101|f containsproperly102|f containsproperly103|f containsproperly104|f -intersects105|t -intersects105|t -intersects105|t -intersects106|t -intersects106|t -intersects106|t -intersects107|f -intersects107|f -intersects107|f -intersects108|f -intersects108|f -intersects108|f -contains105|t -contains105|t -contains105|t -contains106|f -contains106|f -contains106|f -contains107|f -contains107|f -contains107|f -contains108|f -contains108|f -contains108|f -containsproperly105|t -containsproperly105|t -containsproperly105|t -containsproperly106|f -containsproperly106|f -containsproperly106|f -containsproperly107|f -containsproperly107|f -containsproperly107|f -containsproperly108|f -containsproperly108|f -containsproperly108|f -covers105|t -covers105|t -covers105|t -covers106|f -covers106|f -covers106|f -covers107|f -covers107|f -covers107|f -covers108|f -covers108|f -covers108|f +intersectspoly105|t +intersectspoly105|t +intersectspoly105|t +intersectspoint105|t +intersectspoint105|t +intersectspoint105|t +containspoly105|t +containspoly105|t +containspoly105|t +containspoint105|f +containspoint105|f +containspoint105|f +containsproperlypoly105|t +containsproperlypoly105|t +containsproperlypoly105|t +containsproperlypoint105|f +containsproperlypoint105|f +containsproperlypoint105|f +coverspoly105|t +coverspoly105|t +coverspoly105|t +coverspoint105|f +coverspoint105|f +coverspoint105|f +intersectspoly106|f +intersectspoly106|f +intersectspoly106|f +intersectspoint106|f +intersectspoint106|f +intersectspoint106|f +containspoly106|f +containspoly106|f +containspoly106|f +containspoint106|f +containspoint106|f +containspoint106|f +containsproperlypoly106|f +containsproperlypoly106|f +containsproperlypoly106|f +containsproperlypoint106|f +containsproperlypoint106|f +containsproperlypoint106|f +coverspoly106|f +coverspoly106|f +coverspoly106|f +coverspoint106|f +coverspoint106|f +coverspoint106|f intersects200|t|t intersects201|t|t intersects202|t|t @@ -110,42 +110,42 @@ covers206|t|f covers207|t|f covers208|f|f covers209|f|f -types100|t|f|t|f|t|t|t|f -types101|t|f|t|f|t|t|t|f -types102|t|f|t|f|t|t|t|f -types103|f|f|f|f|f|f|f|f -types104|f|f|f|f|f|f|f|f -types105|f|f|f|f|f|f|f|f -types106|t|t|t|t|t|t|t|t -types107|t|t|t|t|t|t|t|t -types108|t|t|t|t|t|t|t|t -types109|t|t|t|t|t|t|f|f -types110|t|t|t|t|t|t|f|f -types111|t|t|t|t|t|t|f|f -types112|f|f|t|f|t|t|f|f -types113|f|f|t|f|t|t|f|f -types114|f|f|t|f|t|t|f|f -intersects310|t -intersects310|t -intersects310|t -intersects311|t -intersects311|t -intersects311|t -contains310|t -contains310|t -contains310|t -contains311|f -contains311|f -contains311|f -containsproperly310|f -containsproperly310|f -containsproperly310|f -containsproperly311|f -containsproperly311|f -containsproperly311|f -covers310|t -covers310|t -covers310|t -covers311|t -covers311|t -covers311|t +300|t|f|t|f|t|t|t|f +301|t|f|t|f|t|t|t|f +302|t|f|t|f|t|t|t|f +303|f|f|f|f|f|f|f|f +304|f|f|f|f|f|f|f|f +305|f|f|f|f|f|f|f|f +306|t|t|t|t|t|t|t|t +307|t|t|t|t|t|t|t|t +308|t|t|t|t|t|t|t|t +309|t|t|t|t|t|t|f|f +310|t|t|t|t|t|t|f|f +311|t|t|t|t|t|t|f|f +312|f|f|t|f|t|t|f|f +313|f|f|t|f|t|t|f|f +314|f|f|t|f|t|t|f|f +intersects400|t +intersects400|t +intersects400|t +intersects401|t +intersects401|t +intersects401|t +contains400|t +contains400|t +contains400|t +contains401|f +contains401|f +contains401|f +containsproperly400|f +containsproperly400|f +containsproperly400|f +containsproperly401|f +containsproperly401|f +containsproperly401|f +covers400|t +covers400|t +covers400|t +covers401|t +covers401|t +covers401|t