Commit ba6646f7 authored by Alexander Barkov's avatar Alexander Barkov Committed by Sergei Golubchik

More tests for MDEV-7563 Support CHECK constraint:

GIS functions
parent 3f32bf62
......@@ -1859,6 +1859,156 @@ SELECT distance FROM t1;
distance
1
DROP TABLE t1;
CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
INSERT INTO t1 (a) VALUES ('point(1 1)');
SELECT AsText(g) FROM t1;
AsText(g)
POINT(1 1)
DROP TABLE t1;
CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
INSERT INTO t1 (x,y) VALUES (10,20);
SELECT AsText(g) FROM t1;
AsText(g)
POINT(10 20)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(2 2)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(1 1)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
SELECT AsText(c) FROM t1;
AsText(c)
GEOMETRYCOLLECTION(POINT(1 1),POINT(2 2))
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
AsText(a) SRID(a) AsText(b) SRID(b)
POINT(1 1) 10 POINT(1 1) 20
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
AsText(b)
LINESTRING(10 10,10 20,20 20,20 10,10 10)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
GeometryType(b)
POLYGON
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(15 15)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
SELECT AsText(b) FROM t1;
AsText(b)
POLYGON((1 1,4 1,4 4,1 4,1 1))
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
GeometryType(b)
POINT
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b));
INSERT INTO t1 (a) VALUES (Point(0,0));
SELECT AsText(c) FROM t1;
AsText(c)
MULTIPOINT(0 0,1 1)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
POINT
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
SELECT b FROM t1;
b
100
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
1
DROP TABLE t1;
#
# End of 10.2 tests
#
......@@ -1554,6 +1554,131 @@ INSERT INTO t1 (g) VALUES (Point(1,0));
SELECT distance FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
INSERT INTO t1 (a) VALUES ('point(1 1)');
SELECT AsText(g) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
INSERT INTO t1 (x,y) VALUES (10,20);
SELECT AsText(g) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
SELECT AsText(c) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
SELECT AsText(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b));
INSERT INTO t1 (a) VALUES (Point(0,0));
SELECT AsText(c) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
SELECT b FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment