2004-03-04 07:50:37 +01:00
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
SHOW FIELDS FROM gis_point;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g point YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_line;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g linestring YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_polygon;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g polygon YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_multi_point;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g multipoint YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_multi_line;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g multilinestring YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_multi_polygon;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g multipolygon YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_geometrycollection;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g geometrycollection YES NULL
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM gis_geometry;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2007-09-20 10:54:46 +02:00
fid int(11) NO PRI NULL
2003-06-02 14:19:06 +02:00
g geometry YES NULL
2004-03-04 07:50:37 +01:00
INSERT INTO gis_point VALUES
2003-03-01 10:16:39 +01:00
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
2003-04-03 12:13:14 +02:00
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_line VALUES
2003-03-01 10:16:39 +01:00
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
2009-04-28 11:47:26 +02:00
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_polygon VALUES
2003-03-01 10:16:39 +01:00
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
2009-04-28 11:47:26 +02:00
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_multi_point VALUES
2003-03-01 10:16:39 +01:00
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
2009-04-28 11:47:26 +02:00
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_multi_line VALUES
2003-03-01 10:16:39 +01:00
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
2009-04-28 11:47:26 +02:00
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_multi_polygon VALUES
2003-03-01 10:16:39 +01:00
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
2009-04-28 11:47:26 +02:00
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
2004-03-04 07:50:37 +01:00
INSERT INTO gis_geometrycollection VALUES
2003-03-01 10:16:39 +01:00
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
2011-09-04 16:11:04 +02:00
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
2011-09-21 09:50:03 +02:00
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
2004-03-04 07:50:37 +01:00
INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon;
INSERT into gis_geometry SELECT * FROM gis_multi_point;
INSERT into gis_geometry SELECT * FROM gis_multi_line;
INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
2003-03-01 10:16:39 +01:00
fid AsText(g)
101 POINT(10 10)
102 POINT(20 10)
103 POINT(20 20)
104 POINT(10 20)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid AsText(g)
105 LINESTRING(0 0,0 10,10 0)
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
107 LINESTRING(10 10,40 10)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(g)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_multi_point;
2003-03-01 10:16:39 +01:00
fid AsText(g)
111 MULTIPOINT(0 0,10 10,10 20,20 20)
112 MULTIPOINT(1 1,11 11,11 21,21 21)
113 MULTIPOINT(3 6,4 10)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_multi_line;
2003-03-01 10:16:39 +01:00
fid AsText(g)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_multi_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(g)
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_geometrycollection;
2003-03-01 10:16:39 +01:00
fid AsText(g)
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
2011-09-21 09:50:03 +02:00
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(g) FROM gis_geometry;
2003-03-01 10:16:39 +01:00
fid AsText(g)
101 POINT(10 10)
102 POINT(20 10)
103 POINT(20 20)
104 POINT(10 20)
105 LINESTRING(0 0,0 10,10 0)
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
107 LINESTRING(10 10,40 10)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
111 MULTIPOINT(0 0,10 10,10 20,20 20)
112 MULTIPOINT(1 1,11 11,11 21,21 21)
113 MULTIPOINT(3 6,4 10)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
2011-09-21 09:50:03 +02:00
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
2004-03-04 07:50:37 +01:00
SELECT fid, Dimension(g) FROM gis_geometry;
2003-03-01 10:16:39 +01:00
fid Dimension(g)
101 0
102 0
103 0
104 0
105 1
106 1
107 1
108 2
109 2
110 2
111 0
112 0
113 0
114 1
115 1
116 1
117 2
118 2
119 2
120 1
121 1
2011-09-04 16:11:04 +02:00
122 0
2011-09-21 09:50:03 +02:00
123 0
2004-03-04 07:50:37 +01:00
SELECT fid, GeometryType(g) FROM gis_geometry;
2003-03-01 10:16:39 +01:00
fid GeometryType(g)
101 POINT
102 POINT
103 POINT
104 POINT
105 LINESTRING
106 LINESTRING
107 LINESTRING
108 POLYGON
109 POLYGON
110 POLYGON
111 MULTIPOINT
112 MULTIPOINT
113 MULTIPOINT
114 MULTILINESTRING
115 MULTILINESTRING
116 MULTILINESTRING
117 MULTIPOLYGON
118 MULTIPOLYGON
119 MULTIPOLYGON
120 GEOMETRYCOLLECTION
121 GEOMETRYCOLLECTION
2011-09-04 16:11:04 +02:00
122 GEOMETRYCOLLECTION
2011-09-21 09:50:03 +02:00
123 GEOMETRYCOLLECTION
2004-03-04 07:50:37 +01:00
SELECT fid, IsEmpty(g) FROM gis_geometry;
2003-03-01 10:16:39 +01:00
fid IsEmpty(g)
101 0
102 0
103 0
104 0
105 0
106 0
107 0
108 0
109 0
110 0
111 0
112 0
113 0
114 0
115 0
116 0
117 0
118 0
119 0
120 0
121 0
2011-09-04 16:11:04 +02:00
122 0
2011-09-21 09:50:03 +02:00
123 0
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
2003-03-01 10:16:39 +01:00
fid AsText(Envelope(g))
101 POLYGON((10 10,10 10,10 10,10 10,10 10))
102 POLYGON((20 10,20 10,20 10,20 10,20 10))
103 POLYGON((20 20,20 20,20 20,20 20,20 20))
104 POLYGON((10 20,10 20,10 20,10 20,10 20))
105 POLYGON((0 0,10 0,10 10,0 10,0 0))
106 POLYGON((10 10,20 10,20 20,10 20,10 10))
107 POLYGON((10 10,40 10,40 10,10 10,10 10))
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0))
110 POLYGON((0 0,30 0,30 30,0 30,0 0))
111 POLYGON((0 0,20 0,20 20,0 20,0 0))
112 POLYGON((1 1,21 1,21 21,1 21,1 1))
113 POLYGON((3 6,4 6,4 10,3 10,3 6))
114 POLYGON((10 0,16 0,16 48,10 48,10 0))
115 POLYGON((10 0,10 0,10 48,10 48,10 0))
116 POLYGON((1 2,21 2,21 8,1 8,1 2))
117 POLYGON((28 0,84 0,84 42,28 42,28 0))
118 POLYGON((28 0,84 0,84 42,28 42,28 0))
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
2011-09-23 12:05:36 +02:00
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
2004-03-04 07:50:37 +01:00
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
2011-09-21 09:50:03 +02:00
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 23 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
2004-03-04 07:50:37 +01:00
SELECT fid, X(g) FROM gis_point;
2003-03-01 10:16:39 +01:00
fid X(g)
101 10
102 20
103 20
104 10
2004-03-04 07:50:37 +01:00
SELECT fid, Y(g) FROM gis_point;
2003-03-01 10:16:39 +01:00
fid Y(g)
101 10
102 10
103 20
104 20
2004-03-04 07:50:37 +01:00
explain extended select X(g),Y(g) FROM gis_point;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid AsText(StartPoint(g))
105 POINT(0 0)
106 POINT(10 10)
107 POINT(10 10)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(EndPoint(g)) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid AsText(EndPoint(g))
105 POINT(10 0)
106 POINT(10 10)
107 POINT(40 10)
2004-03-04 07:50:37 +01:00
SELECT fid, GLength(g) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid GLength(g)
2009-12-22 17:23:13 +01:00
105 24.14213562373095
2003-03-01 10:16:39 +01:00
106 40
107 30
2004-03-04 07:50:37 +01:00
SELECT fid, NumPoints(g) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid NumPoints(g)
105 3
106 5
107 2
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid AsText(PointN(g, 2))
105 POINT(0 10)
106 POINT(20 10)
107 POINT(40 10)
2004-03-04 07:50:37 +01:00
SELECT fid, IsClosed(g) FROM gis_line;
2003-03-01 10:16:39 +01:00
fid IsClosed(g)
105 0
106 1
107 0
2004-03-04 07:50:37 +01:00
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(Centroid(g))
108 POINT(15 15)
2009-12-22 17:23:13 +01:00
109 POINT(25.416666666666668 25.416666666666668)
2003-03-01 10:16:39 +01:00
110 POINT(20 10)
2004-03-04 07:50:37 +01:00
SELECT fid, Area(g) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid Area(g)
108 100
109 2400
110 450
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(ExteriorRing(g))
108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
110 LINESTRING(0 0,30 0,30 30,0 0)
2004-03-04 07:50:37 +01:00
SELECT fid, NumInteriorRings(g) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid NumInteriorRings(g)
108 0
109 1
110 0
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(InteriorRingN(g, 1))
108 NULL
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
2004-03-04 07:50:37 +01:00
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
2004-03-04 07:50:37 +01:00
SELECT fid, IsClosed(g) FROM gis_multi_line;
2003-03-06 13:25:06 +01:00
fid IsClosed(g)
114 0
115 0
116 0
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
2003-03-06 13:25:06 +01:00
fid AsText(Centroid(g))
2009-12-22 17:23:13 +01:00
117 POINT(55.58852775304245 17.426536064113982)
118 POINT(55.58852775304245 17.426536064113982)
2003-03-06 13:25:06 +01:00
119 POINT(2 2)
2004-03-04 07:50:37 +01:00
SELECT fid, Area(g) FROM gis_multi_polygon;
2003-03-06 13:25:06 +01:00
fid Area(g)
117 1684.5
118 1684.5
119 4.5
2004-03-04 07:50:37 +01:00
SELECT fid, NumGeometries(g) from gis_multi_point;
2003-03-01 10:16:39 +01:00
fid NumGeometries(g)
111 4
112 4
113 2
2004-03-04 07:50:37 +01:00
SELECT fid, NumGeometries(g) from gis_multi_line;
2003-03-01 10:16:39 +01:00
fid NumGeometries(g)
114 2
115 1
116 2
2004-03-04 07:50:37 +01:00
SELECT fid, NumGeometries(g) from gis_multi_polygon;
2003-03-01 10:16:39 +01:00
fid NumGeometries(g)
117 2
118 2
119 1
2004-03-04 07:50:37 +01:00
SELECT fid, NumGeometries(g) from gis_geometrycollection;
2003-03-01 10:16:39 +01:00
fid NumGeometries(g)
120 2
121 2
2011-09-04 16:11:04 +02:00
122 0
2011-09-21 09:50:03 +02:00
123 0
2004-03-04 07:50:37 +01:00
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
2003-03-01 10:16:39 +01:00
fid AsText(GeometryN(g, 2))
111 POINT(10 10)
112 POINT(11 11)
113 POINT(4 10)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
2003-03-01 10:16:39 +01:00
fid AsText(GeometryN(g, 2))
114 LINESTRING(16 0,16 23,16 48)
115 NULL
116 LINESTRING(2 5,5 8,21 7)
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
2003-03-01 10:16:39 +01:00
fid AsText(GeometryN(g, 2))
117 POLYGON((59 18,67 18,67 13,59 13,59 18))
118 POLYGON((59 18,67 18,67 13,59 13,59 18))
119 NULL
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
2003-03-01 10:16:39 +01:00
fid AsText(GeometryN(g, 2))
120 LINESTRING(0 0,10 10)
121 LINESTRING(3 6,7 9)
2011-09-04 16:11:04 +02:00
122 NULL
2011-09-21 09:50:03 +02:00
123 NULL
2004-03-04 07:50:37 +01:00
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
2011-09-04 16:11:04 +02:00
122 NULL
2011-09-21 09:50:03 +02:00
123 NULL
2004-03-04 07:50:37 +01:00
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
2003-03-01 10:16:39 +01:00
SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
2004-03-04 07:50:37 +01:00
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
2003-03-01 10:16:39 +01:00
first second w c o e d t i r
2015-03-15 19:20:38 +01:00
120 120 1 1 0 1 0 0 1 0
Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).
Add tests for all MBR* functions for various combinations of shapes, lines and points.
mysql-test/include/gis_generic.inc:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
mysql-test/r/archive_gis.result:
Update test results.
mysql-test/r/bdb_gis.result:
Update test results.
mysql-test/r/gis.result:
Update test results.
mysql-test/r/innodb_gis.result:
Update test results.
mysql-test/r/ndb_gis.result:
Update test results.
mysql-test/t/gis.test:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
sql/spatial.h:
Add MBR::dimension() (map MBR to integral dimension: point -> 0, line -> 1,
polygon -> 2, invalid -> -1)
Fix MBR::overlaps() to handle MBRs which are shifted on one dimension only, and to
take MBR dimension into account. Also, test both within() and contains() predicates (so
that overlaps(a, b) == overlaps(b, a)).
2007-03-23 23:28:07 +01:00
120 121 0 0 1 0 0 0 1 0
2013-03-22 14:32:27 +01:00
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
2003-03-01 10:16:39 +01:00
121 120 0 0 1 0 0 0 1 0
2015-06-22 20:33:35 +02:00
121 121 1 1 0 1 0 0 1 0
2013-03-22 14:32:27 +01:00
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
122 121 NULL NULL NULL NULL NULL NULL NULL NULL
122 122 NULL NULL NULL NULL NULL NULL NULL NULL
122 123 NULL NULL NULL NULL NULL NULL NULL NULL
123 120 NULL NULL NULL NULL NULL NULL NULL NULL
123 121 NULL NULL NULL NULL NULL NULL NULL NULL
123 122 NULL NULL NULL NULL NULL NULL NULL NULL
123 123 NULL NULL NULL NULL NULL NULL NULL NULL
2003-11-06 20:03:11 +01:00
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
2004-03-04 07:50:37 +01:00
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
2011-09-21 09:50:03 +02:00
1 SIMPLE g1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
2003-11-06 20:03:11 +01:00
Warnings:
2011-09-23 12:05:36 +02:00
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
2004-03-04 07:50:37 +01:00
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
gp point,
2003-03-31 06:19:20 +02:00
ln linestring,
pg polygon,
2004-03-04 07:50:37 +01:00
mp multipoint,
2003-03-31 06:19:20 +02:00
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
2004-03-04 07:50:37 +01:00
SHOW FIELDS FROM t1;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2004-03-04 07:50:37 +01:00
gp point YES NULL
2003-06-02 14:19:06 +02:00
ln linestring YES NULL
pg polygon YES NULL
2004-03-04 07:50:37 +01:00
mp multipoint YES NULL
2003-06-02 14:19:06 +02:00
mln multilinestring YES NULL
mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
2004-03-04 07:50:37 +01:00
ALTER TABLE t1 ADD fid INT NOT NULL;
SHOW FIELDS FROM t1;
2003-06-02 14:19:06 +02:00
Field Type Null Key Default Extra
2004-03-04 07:50:37 +01:00
gp point YES NULL
2003-06-02 14:19:06 +02:00
ln linestring YES NULL
pg polygon YES NULL
2004-03-04 07:50:37 +01:00
mp multipoint YES NULL
2003-06-02 14:19:06 +02:00
mln multilinestring YES NULL
mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
2007-09-20 10:54:46 +02:00
fid int(11) NO NULL
2004-03-04 07:50:37 +01:00
DROP TABLE t1;
2003-04-03 12:13:14 +02:00
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
POINT(1 4)
2003-11-06 20:03:11 +01:00
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
2003-11-06 20:03:11 +01:00
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
2003-11-06 20:03:11 +01:00
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2003-11-06 20:03:11 +01:00
Warnings:
2011-05-04 20:20:17 +02:00
Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
2003-11-06 20:03:11 +01:00
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
2006-07-28 19:27:01 +02:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2003-11-06 20:03:11 +01:00
Warnings:
2015-04-28 12:31:49 +02:00
Note 1003 select st_issimple(st_multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
2004-03-16 11:59:22 +01:00
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
2005-04-29 17:23:02 +02:00
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
2004-03-17 11:03:26 +01:00
insert IGNORE into t1 values ('Garbage');
2005-04-29 17:23:02 +02:00
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
2004-03-16 11:59:22 +01:00
alter table t1 add spatial index(a);
drop table t1;
2004-08-26 13:51:26 +02:00
create table t1(a geometry not null, spatial index(a));
insert into t1 values
(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
or
MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
AsText(a)
POINT(1 1)
POINT(3 3)
POINT(4 4)
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
AsText(a)
POINT(1 1)
drop table t1;
2004-09-15 16:46:42 +02:00
CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
2006-07-04 09:56:53 +02:00
create table t1 select GeomFromWKB(POINT(1,3));
2004-09-22 19:36:53 +02:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
2007-03-05 14:12:37 +01:00
`GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL
2004-09-22 19:36:53 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
2004-10-22 17:32:02 +02:00
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
geometry NOT NULL default '') ENGINE=MyISAM ;
2006-07-19 01:04:18 +02:00
Warnings:
Warning 1101 BLOB/TEXT column 'geo' can't have a default value
2004-10-22 17:32:02 +02:00
insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
36.240569,-115.083135 36.240569,-115.079835
36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
2011-11-27 17:46:20 +01:00
85998 MULTIPOLYGON 1 POINT(115.31877315203187 -36.23747282102153)
2004-10-22 17:32:02 +02:00
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
2011-11-27 17:46:20 +01:00
85984 MULTIPOLYGON 1 POINT(-114.87787186923313 36.33101763469059)
2004-10-22 17:32:02 +02:00
drop table t1;
2007-03-02 12:09:44 +01:00
create table t1 (fl geometry not null);
2005-04-29 17:23:02 +02:00
insert into t1 values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
2007-03-02 12:09:44 +01:00
ERROR 23000: Column 'fl' cannot be null
2005-04-29 17:23:02 +02:00
drop table t1;
2005-11-01 08:43:34 +01:00
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))))
POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))
POINT(10 10)
2006-12-07 06:11:56 +01:00
create table t1 (g GEOMETRY);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
2007-11-17 14:11:05 +01:00
def asbinary(g) 252 4294967295 0 Y 128 0 63
2006-12-07 06:11:56 +01:00
asbinary(g)
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
2007-12-12 18:19:24 +01:00
load data infile '../../std_data/bad_gis_data.dat' into table t1;
2006-12-07 10:38:16 +01:00
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
2006-12-07 06:11:56 +01:00
alter table t1 enable keys;
drop table t1;
2007-03-02 12:09:44 +01:00
create table t1 (a int, b blob);
insert into t1 values (1, ''), (2, NULL), (3, '1');
select * from t1;
a b
1
2 NULL
3 1
select
geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
y(b) IS NULL
from t1;
2010-09-09 11:40:17 +02:00
ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
2007-03-02 12:09:44 +01:00
select
within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
intersects(b, b) IS NULL, crosses(b, b) IS NULL
from t1;
within(b, b) IS NULL contains(b, b) IS NULL overlaps(b, b) IS NULL equals(b, b) IS NULL disjoint(b, b) IS NULL touches(b, b) IS NULL intersects(b, b) IS NULL crosses(b, b) IS NULL
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
select
point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
multilinestring(b) IS NULL, multipolygon(b) IS NULL,
geometrycollection(b) IS NULL
from t1;
2010-09-09 11:40:17 +02:00
ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
2007-03-02 12:09:44 +01:00
drop table t1;
2007-03-26 12:17:40 +02:00
CREATE TABLE t1(a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
NULL
DROP TABLE t1;
2007-10-03 10:35:35 +02:00
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
INSERT INTO `t1` VALUES ('','0000-00-00');
select geomfromtext(col9,col89) as a from t1;
a
NULL
DROP TABLE t1;
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_length parameter for BLOB-returning functions must be big enough
for any possible content. Otherwise the field created for a table
will be too small.
mysql-test/r/gis.result:
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
test result
mysql-test/t/gis.test:
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
test case
sql/field.cc:
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_field_size used instead of numeric value
sql/field.h:
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_field_size constant defined
sql/item_geofunc.cc:
Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_length parameter fixed
2007-11-13 07:51:47 +01:00
CREATE TABLE t1 (
geomdata polygon NOT NULL,
SPATIAL KEY index_geom (geomdata)
) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
CREATE TABLE t2 (
geomdata polygon NOT NULL,
SPATIAL KEY index_geom (geomdata)
) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
CREATE TABLE t3
select
aswkb(ws.geomdata) AS geomdatawkb
from
t1 ws
union
select
aswkb(ws.geomdata) AS geomdatawkb
from
t2 ws;
describe t3;
Field Type Null Key Default Extra
geomdatawkb longblob YES NULL
drop table t1;
drop table t2;
drop table t3;
2007-11-24 11:57:09 +01:00
create table t1(col1 geometry default null,col15 geometrycollection not
2007-11-19 08:03:03 +01:00
null,spatial index(col15),index(col1(15)))engine=myisam;
insert into t1 set col15 = GeomFromText('POINT(6 5)');
insert into t1 set col15 = GeomFromText('POINT(6 5)');
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
2007-03-02 12:09:44 +01:00
End of 4.1 tests
2005-08-05 17:26:55 +02:00
create table t1 (s1 geometry not null,s2 char(100));
create trigger t1_bu before update on t1 for each row set new.s1 = null;
insert into t1 values (null,null);
ERROR 23000: Column 's1' cannot be null
drop table t1;
2005-08-27 17:06:35 +02:00
drop procedure if exists fn3;
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Fix tests for new behaviour: an error is thrown if a NON DETERMINISTIC
stored function (SF) is called during statement-based replication (SBR).
mysql-test/r/func_time.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/gis.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/grant2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/innodb_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/ps.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/query_cache.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/query_cache_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/rpl_sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Move test for SF-calls in different replication modes to its own file, rpl_sf.
mysql-test/r/rpl_sp_effects.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/timezone2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/func_time.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/gis.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/grant2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/innodb_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/ps.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp_effects.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/timezone2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
sql/item_func.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
If 'log_bin_trust_function_creators' variable is set, don't throw an error
on calling a non-deterministc function in statement-based replication (SBR).
sql/sql_parse.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Do not throw an error on calling a NON DETERMINISTIC stored procedure (SP)
while doing statement-based replication (SBR), as the routine body is
executed statement-by-statement.
mysql-test/r/rpl_sf.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
mysql-test/t/rpl_sf.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
2006-11-17 21:30:28 +01:00
create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
2005-08-10 10:45:05 +02:00
show create function fn3;
Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
Function sql_mode Create Function character_set_client collation_connection Database Collation
2015-08-11 18:45:38 +02:00
fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Fix tests for new behaviour: an error is thrown if a NON DETERMINISTIC
stored function (SF) is called during statement-based replication (SBR).
mysql-test/r/func_time.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/gis.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/grant2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/innodb_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/ps.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/query_cache.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/query_cache_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/rpl_sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Move test for SF-calls in different replication modes to its own file, rpl_sf.
mysql-test/r/rpl_sp_effects.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/timezone2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/func_time.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/gis.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/grant2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/innodb_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/ps.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp_effects.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/timezone2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
sql/item_func.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
If 'log_bin_trust_function_creators' variable is set, don't throw an error
on calling a non-deterministc function in statement-based replication (SBR).
sql/sql_parse.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Do not throw an error on calling a NON DETERMINISTIC stored procedure (SP)
while doing statement-based replication (SBR), as the routine body is
executed statement-by-statement.
mysql-test/r/rpl_sf.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
mysql-test/t/rpl_sf.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
2006-11-17 21:30:28 +01:00
DETERMINISTIC
Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci
2005-08-10 10:45:05 +02:00
select astext(fn3());
astext(fn3())
POINT(1 1)
drop function fn3;
2005-09-26 11:55:52 +02:00
create table t1(pt POINT);
alter table t1 add primary key pti(pt);
2005-10-15 19:23:13 +02:00
drop table t1;
create table t1(pt GEOMETRY);
alter table t1 add primary key pti(pt);
2005-09-26 11:55:52 +02:00
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
drop table t1;
2006-07-04 09:56:53 +02:00
create table t1 select GeomFromText('point(1 1)');
desc t1;
Field Type Null Key Default Extra
2007-03-02 12:09:44 +01:00
GeomFromText('point(1 1)') geometry YES NULL
2006-07-04 09:56:53 +02:00
drop table t1;
2007-02-12 12:41:36 +01:00
create table t1 (g geometry not null);
insert into t1 values(default);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
2014-06-30 21:30:24 +02:00
CREATE TABLE t1 (a GEOMETRY);
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
CREATE VIEW v2 AS SELECT a FROM t1;
DESCRIBE v1;
Field Type Null Key Default Extra
GeomFromwkb(ASBINARY(a)) geometry YES NULL
DESCRIBE v2;
Field Type Null Key Default Extra
a geometry YES NULL
DROP VIEW v1,v2;
DROP TABLE t1;
Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).
Add tests for all MBR* functions for various combinations of shapes, lines and points.
mysql-test/include/gis_generic.inc:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
mysql-test/r/archive_gis.result:
Update test results.
mysql-test/r/bdb_gis.result:
Update test results.
mysql-test/r/gis.result:
Update test results.
mysql-test/r/innodb_gis.result:
Update test results.
mysql-test/r/ndb_gis.result:
Update test results.
mysql-test/t/gis.test:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
sql/spatial.h:
Add MBR::dimension() (map MBR to integral dimension: point -> 0, line -> 1,
polygon -> 2, invalid -> -1)
Fix MBR::overlaps() to handle MBRs which are shifted on one dimension only, and to
take MBR dimension into account. Also, test both within() and contains() predicates (so
that overlaps(a, b) == overlaps(b, a)).
2007-03-23 23:28:07 +01:00
create table t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
2015-06-22 20:33:35 +02:00
down2,left2,right2,up2
Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).
Add tests for all MBR* functions for various combinations of shapes, lines and points.
mysql-test/include/gis_generic.inc:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
mysql-test/r/archive_gis.result:
Update test results.
mysql-test/r/bdb_gis.result:
Update test results.
mysql-test/r/gis.result:
Update test results.
mysql-test/r/innodb_gis.result:
Update test results.
mysql-test/r/ndb_gis.result:
Update test results.
mysql-test/t/gis.test:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
sql/spatial.h:
Add MBR::dimension() (map MBR to integral dimension: point -> 0, line -> 1,
polygon -> 2, invalid -> -1)
Fix MBR::overlaps() to handle MBRs which are shifted on one dimension only, and to
take MBR dimension into account. Also, test both within() and contains() predicates (so
that overlaps(a, b) == overlaps(b, a)).
2007-03-23 23:28:07 +01:00
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
2015-06-22 20:33:35 +02:00
down2,left2,right2,up2
Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).
Add tests for all MBR* functions for various combinations of shapes, lines and points.
mysql-test/include/gis_generic.inc:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
mysql-test/r/archive_gis.result:
Update test results.
mysql-test/r/bdb_gis.result:
Update test results.
mysql-test/r/gis.result:
Update test results.
mysql-test/r/innodb_gis.result:
Update test results.
mysql-test/r/ndb_gis.result:
Update test results.
mysql-test/t/gis.test:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
sql/spatial.h:
Add MBR::dimension() (map MBR to integral dimension: point -> 0, line -> 1,
polygon -> 2, invalid -> -1)
Fix MBR::overlaps() to handle MBRs which are shifted on one dimension only, and to
take MBR dimension into account. Also, test both within() and contains() predicates (so
that overlaps(a, b) == overlaps(b, a)).
2007-03-23 23:28:07 +01:00
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
2013-07-26 13:03:56 +02:00
create table t1(f1 geometry, f2 linestring, f3 linestring);
2007-06-07 22:33:03 +02:00
select f1 from t1 union select f1 from t1;
f1
2013-07-26 13:03:56 +02:00
insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'),
2007-06-07 22:33:03 +02:00
GeomFromText('LINESTRING(0 0,1 1,2 2)'));
select AsText(f2),AsText(f3) from t1;
AsText(f2) AsText(f3)
2013-07-26 13:03:56 +02:00
LINESTRING(1 1,2 2) LINESTRING(0 0,1 1,2 2)
2007-06-07 22:33:03 +02:00
select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;
AsText(a)
2013-07-26 13:03:56 +02:00
LINESTRING(1 1,2 2)
2007-06-07 22:33:03 +02:00
LINESTRING(0 0,1 1,2 2)
create table t2 as select f2 as a from t1 union select f3 from t1;
desc t2;
Field Type Null Key Default Extra
2013-07-26 13:03:56 +02:00
a linestring YES NULL
2007-06-07 22:33:03 +02:00
select AsText(a) from t2;
AsText(a)
2013-07-26 13:03:56 +02:00
LINESTRING(1 1,2 2)
2007-06-07 22:33:03 +02:00
LINESTRING(0 0,1 1,2 2)
drop table t1, t2;
2007-07-05 17:24:48 +02:00
SELECT 1;
1
1
2007-10-10 15:26:02 +02:00
CREATE TABLE t1 (p POINT);
CREATE TABLE t2 (p POINT, INDEX(p));
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 system p NULL NULL NULL 1
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
EXPLAIN
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
2
EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
2011-11-30 17:44:51 +01:00
1 SIMPLE t2 ref p p 28 const # Using where
2007-10-10 15:26:02 +02:00
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
2
EXPLAIN
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
2
DROP TABLE t1, t2;
End of 5.0 tests
2011-02-02 14:17:48 +01:00
#
# Test for bug #58650 "Failing assertion: primary_key_no == -1 ||
# primary_key_no == 0".
#
drop table if exists t1;
# The minimal test case.
create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a));
drop table t1;
# The original test case.
create table t1 (a int not null, b linestring not null, unique key b (b(12)));
create unique index a on t1(a);
drop table t1;
2007-11-20 14:04:24 +01:00
create table `t1` (`col002` point)engine=myisam;
insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
min(`col002`)
NULL
drop table t1;
2009-10-21 10:43:45 +02:00
#
# Bug #47780: crash when comparing GIS items from subquery
#
CREATE TABLE t1(a INT, b MULTIPOLYGON);
INSERT INTO t1 VALUES
(0,
GEOMFROMTEXT(
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
# must not crash
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
1
DROP TABLE t1;
2009-12-10 10:28:38 +01:00
#
# Bug #49250 : spatial btree index corruption and crash
# Part one : spatial syntax check
#
CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
SPATIAL INDEX USING BTREE (col1));
2011-12-12 23:58:40 +01:00
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2
2009-12-10 10:28:38 +01:00
CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
CREATE SPATIAL INDEX USING BTREE ON t2(col);
2011-12-12 23:58:40 +01:00
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
2009-12-10 10:28:38 +01:00
ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
2011-12-12 23:58:40 +01:00
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1
2009-12-10 10:28:38 +01:00
DROP TABLE t2;
Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).
Add tests for all MBR* functions for various combinations of shapes, lines and points.
mysql-test/include/gis_generic.inc:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
mysql-test/r/archive_gis.result:
Update test results.
mysql-test/r/bdb_gis.result:
Update test results.
mysql-test/r/gis.result:
Update test results.
mysql-test/r/innodb_gis.result:
Update test results.
mysql-test/r/ndb_gis.result:
Update test results.
mysql-test/t/gis.test:
Add tests & checks for bug #24563 and bug #24588 - some GIS functions missing in
5.1; many GIS functions not tested; Overlaps() function was incorrect when MBR shifted
only along one axis; Overlaps() needs to take dimension of shape into account.
sql/spatial.h:
Add MBR::dimension() (map MBR to integral dimension: point -> 0, line -> 1,
polygon -> 2, invalid -> -1)
Fix MBR::overlaps() to handle MBRs which are shifted on one dimension only, and to
take MBR dimension into account. Also, test both within() and contains() predicates (so
that overlaps(a, b) == overlaps(b, a)).
2007-03-23 23:28:07 +01:00
End of 5.0 tests
2007-01-24 11:49:36 +01:00
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
Field Type Null Key Default Extra
f1 tinyint(1) YES NULL
f2 char(1) YES NULL
f3 varchar(1) YES NULL
f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
2009-06-17 16:58:33 +02:00
SELECT MultiPoint(12345,'');
2010-09-07 11:37:46 +02:00
ERROR 22007: Illegal non geometric '12345' value found during parsing
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
2010-09-09 11:40:17 +02:00
ERROR 22007: Illegal non geometric ''00000'' value found during parsing
2010-08-30 09:51:46 +02:00
#
# BUG#51875: crash when loading data into geometry function polyfromwkb
#
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
2013-02-20 22:03:45 +01:00
create table t1(a geometry NOT NULL)engine=myisam;
2011-01-12 14:02:41 +01:00
insert into t1 values (geomfromtext("point(0 1)"));
insert into t1 values (geomfromtext("point(1 0)"));
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
NULL
NULL
drop table t1;
2011-02-15 12:03:05 +01:00
#
# Test for bug #59888 "debug assertion when attempt to create spatial index
# on char > 31 bytes".
#
create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
2011-03-09 16:21:22 +01:00
ERROR HY000: Incorrect arguments to SPATIAL INDEX
2011-02-15 12:03:05 +01:00
drop table t1;
2011-02-24 12:23:38 +01:00
CREATE TABLE t0 (a BINARY(32) NOT NULL);
CREATE SPATIAL INDEX i on t0 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
INSERT INTO t0 VALUES (1);
2011-05-04 20:20:17 +02:00
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
2011-02-24 12:23:38 +01:00
ERROR HY000: Incorrect arguments to SPATIAL INDEX
2011-05-04 20:20:17 +02:00
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
CREATE SPATIAL INDEX idx0 ON t1(col0);
2011-02-24 12:23:38 +01:00
ERROR HY000: Incorrect arguments to SPATIAL INDEX
2011-05-04 20:20:17 +02:00
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
2011-02-24 12:23:38 +01:00
ERROR HY000: Incorrect arguments to SPATIAL INDEX
2011-05-04 20:20:17 +02:00
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t3 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
2011-02-24 12:23:38 +01:00
DROP TABLE t0, t1, t2;
2012-03-05 18:58:07 +01:00
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
2015-06-23 08:57:05 +02:00
-1
2012-03-05 19:15:23 +01:00
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
#
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
ERROR 22007: Illegal non geometric '' value found during parsing
2013-03-18 14:58:00 +01:00
#
# MDEV-4252 geometry query crashes server
#
2013-03-10 20:08:05 +01:00
select astext(0x0100000000030000000100000000000010);
astext(0x0100000000030000000100000000000010)
NULL
2013-03-27 10:03:28 +01:00
select astext(st_centroid(0x0100000000030000000100000000000010));
astext(st_centroid(0x0100000000030000000100000000000010))
NULL
select astext(st_exteriorring(0x0100000000030000000100000000000010));
astext(st_exteriorring(0x0100000000030000000100000000000010))
NULL
2013-03-18 14:58:00 +01:00
select envelope(0x0100000000030000000100000000000010);
envelope(0x0100000000030000000100000000000010)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
NULL
2013-03-19 14:16:10 +01:00
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
NULL
2013-03-19 14:25:58 +01:00
#
# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
#
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
NULL
2007-03-24 00:48:03 +01:00
End of 5.1 tests
2011-09-21 06:29:37 +02:00
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
1.5
2011-09-21 10:26:21 +02:00
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'))
160
2011-05-04 20:20:17 +02:00
DROP DATABASE IF EXISTS gis_ogs;
CREATE DATABASE gis_ogs;
USE gis_ogs;
#
# C.3.3.1 Geometry types and functions schema construction
#
CREATE TABLE lakes (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
shore POLYGON);
CREATE TABLE road_segments (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
aliases CHARACTER VARYING(64),
num_lanes INTEGER,
centerline LINESTRING);
CREATE TABLE divided_routes (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
num_lanes INTEGER,
centerlines MULTILINESTRING);
CREATE TABLE forests (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
boundary MULTIPOLYGON);
CREATE TABLE bridges (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
position POINT);
CREATE TABLE streams (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
centerline LINESTRING);
CREATE TABLE buildings (
fid INTEGER NOT NULL PRIMARY KEY,
address CHARACTER VARYING(64),
position POINT,
footprint POLYGON);
CREATE TABLE ponds (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
type CHARACTER VARYING(64),
shores MULTIPOLYGON);
CREATE TABLE named_places (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
boundary POLYGON);
CREATE TABLE map_neatlines (
fid INTEGER NOT NULL PRIMARY KEY,
neatline POLYGON);
#
# C.3.3.2 Geometry types and functions schema data loading
#
# Lakes
INSERT INTO lakes VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
(52 18,66 23,73 9,48 6,52 18),
(59 18,67 18,67 13,59 13,59 18)
)',
101));
# Road Segments
INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
# DividedRoutes
INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
# Forests
INSERT INTO forests VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
101));
# Bridges
INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
# Streams
INSERT INTO streams VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
INSERT INTO streams VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
# Buildings
INSERT INTO buildings VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
INSERT INTO buildings VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
# Ponds
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
# Named Places
INSERT INTO named_places VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
INSERT INTO named_places VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
# Map Neatlines
INSERT INTO map_neatlines VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
#
# C.3.3.3 Geometry types and functions schema test queries
# Conformance Item T6
SELECT Dimension(shore)
FROM lakes
WHERE name = 'Blue Lake';
Dimension(shore)
2
# Conformance Item T7
SELECT GeometryType(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
GeometryType(centerlines)
MULTILINESTRING
# Conformance Item T8
SELECT AsText(boundary)
FROM named_places
WHERE name = 'Goose Island';
AsText(boundary)
POLYGON((67 13,67 18,59 18,59 13,67 13))
# Conformance Item T9
SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
FROM named_places
WHERE name = 'Goose Island';
AsText(PolyFromWKB(AsBinary(boundary),101))
POLYGON((67 13,67 18,59 18,59 13,67 13))
# Conformance Item T10
SELECT SRID(boundary)
FROM named_places
WHERE name = 'Goose Island';
SRID(boundary)
101
# Conformance Item T11
SELECT IsEmpty(centerline)
FROM road_segments
WHERE name = 'Route 5'
AND aliases = 'Main Street';
IsEmpty(centerline)
0
2014-11-27 21:29:37 +01:00
# Conformance Item T12
SELECT IsSimple(shore)
FROM lakes
WHERE name = 'Blue Lake';
IsSimple(shore)
1
# Conformance Item T13
SELECT AsText(ST_Boundary(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(ST_Boundary(boundary))
LINESTRING(67 13,67 18,59 18,59 13,67 13)
2011-05-04 20:20:17 +02:00
# Conformance Item T14
SELECT AsText(Envelope(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(Envelope(boundary))
POLYGON((59 13,67 13,67 18,59 18,59 13))
# Conformance Item T15
SELECT X(position)
FROM bridges
WHERE name = 'Cam Bridge';
X(position)
44
# Conformance Item T16
SELECT Y(position)
FROM bridges
WHERE name = 'Cam Bridge';
Y(position)
31
# Conformance Item T17
SELECT AsText(StartPoint(centerline))
FROM road_segments
WHERE fid = 102;
AsText(StartPoint(centerline))
POINT(0 18)
# Conformance Item T18
SELECT AsText(EndPoint(centerline))
FROM road_segments
WHERE fid = 102;
AsText(EndPoint(centerline))
POINT(44 31)
2014-11-27 21:29:37 +01:00
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
FROM named_places
WHERE name = 'Goose Island';
IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
1
# Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
FROM named_places
WHERE name = 'Goose Island';
IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
2015-03-13 13:10:31 +01:00
1
2011-05-04 20:20:17 +02:00
# Conformance Item T21
SELECT GLength(centerline)
FROM road_segments
WHERE fid = 106;
GLength(centerline)
26
# Conformance Item T22
SELECT NumPoints(centerline)
FROM road_segments
WHERE fid = 102;
NumPoints(centerline)
5
# Conformance Item T23
SELECT AsText(PointN(centerline, 1))
FROM road_segments
WHERE fid = 102;
AsText(PointN(centerline, 1))
POINT(0 18)
# Conformance Item T24
SELECT AsText(Centroid(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(Centroid(boundary))
POINT(63 15.5)
2014-11-27 21:29:37 +01:00
SELECT ST_Contains(boundary, PointOnSurface(boundary))
FROM named_places
WHERE name = 'Goose Island';
ST_Contains(boundary, PointOnSurface(boundary))
1
2011-05-04 20:20:17 +02:00
# Conformance Item T26
SELECT Area(boundary)
FROM named_places
WHERE name = 'Goose Island';
Area(boundary)
40
# Conformance Item T27
SELECT AsText(ExteriorRing(shore))
FROM lakes
WHERE name = 'Blue Lake';
AsText(ExteriorRing(shore))
LINESTRING(52 18,66 23,73 9,48 6,52 18)
# Conformance Item T28
SELECT NumInteriorRings(shore)
FROM lakes
WHERE name = 'Blue Lake';
NumInteriorRings(shore)
1
# Conformance Item T29
SELECT AsText(InteriorRingN(shore, 1))
FROM lakes
WHERE name = 'Blue Lake';
AsText(InteriorRingN(shore, 1))
LINESTRING(59 18,67 18,67 13,59 13,59 18)
# Conformance Item T30
SELECT NumGeometries(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
NumGeometries(centerlines)
2
# Conformance Item T31
SELECT AsText(GeometryN(centerlines, 2))
FROM divided_routes
WHERE name = 'Route 75';
AsText(GeometryN(centerlines, 2))
LINESTRING(16 0,16 23,16 48)
# Conformance Item T32
SELECT IsClosed(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
IsClosed(centerlines)
0
# Conformance Item T33
SELECT GLength(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
GLength(centerlines)
96
# Conformance Item T34
SELECT AsText(Centroid(shores))
FROM ponds
WHERE fid = 120;
AsText(Centroid(shores))
POINT(25 42)
2014-11-27 21:29:37 +01:00
# Conformance Item T35
SELECT Contains(shores, PointOnSurface(shores))
FROM ponds
WHERE fid = 120;
Contains(shores, PointOnSurface(shores))
1
2011-05-04 20:20:17 +02:00
# Conformance Item T36
SELECT Area(shores)
FROM ponds
WHERE fid = 120;
Area(shores)
8
# Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
FROM named_places
WHERE name = 'Goose Island';
ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
1
# Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
FROM divided_routes, named_places
WHERE divided_routes.name = 'Route 75'
AND named_places.name = 'Ashton';
ST_Disjoint(centerlines, boundary)
1
# Conformance Item T39
SELECT ST_Touches(centerline, shore)
FROM streams, lakes
WHERE streams.name = 'Cam Stream'
AND lakes.name = 'Blue Lake';
ST_Touches(centerline, shore)
1
2014-11-27 21:29:37 +01:00
# Conformance Item T40
SELECT ST_Within(footprint, boundary)
FROM named_places, buildings
WHERE named_places.name = 'Ashton'
AND buildings.address = '215 Main Street';
ST_Within(footprint, boundary)
1
# Conformance Item T41
SELECT ST_Overlaps(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Overlaps(forests.boundary, named_places.boundary)
1
2011-05-04 20:20:17 +02:00
# Conformance Item T42
SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
Crosses(road_segments.centerline, divided_routes.centerlines)
1
# Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
ST_Intersects(road_segments.centerline, divided_routes.centerlines)
1
# Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Contains(forests.boundary, named_places.boundary)
0
2014-11-27 21:29:37 +01:00
# Conformance Item T45
SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
1
2011-05-04 20:20:17 +02:00
# Conformance Item T46
SELECT ST_Distance(position, boundary)
FROM bridges, named_places
WHERE bridges.name = 'Cam Bridge'
AND named_places.name = 'Ashton';
ST_Distance(position, boundary)
12
2014-11-27 21:29:37 +01:00
# Conformance Item T47
SELECT AsText(ST_Intersection(centerline, shore))
FROM streams, lakes
WHERE streams.name = 'Cam Stream'
AND lakes.name = 'Blue Lake';
AsText(ST_Intersection(centerline, shore))
POINT(52 18)
2011-05-04 20:20:17 +02:00
# Conformance Item T48
SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
FROM named_places, forests
WHERE named_places.name = 'Ashton'
AND forests.name = 'Green Forest';
AsText(ST_Difference(named_places.boundary, forests.boundary))
POLYGON((56 34,62 48,84 48,84 42,56 34))
SELECT AsText(ST_Union(shore, boundary))
FROM lakes, named_places
WHERE lakes.name = 'Blue Lake'
AND named_places.name = 'Goose Island';
AsText(ST_Union(shore, boundary))
POLYGON((48 6,52 18,66 23,73 9,48 6))
# Conformance Item T50
SELECT AsText(ST_SymDifference(shore, boundary))
FROM lakes, named_places
WHERE lakes.name = 'Blue Lake'
AND named_places.name = 'Ashton';
AsText(ST_SymDifference(shore, boundary))
2011-09-01 08:44:56 +02:00
MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
2011-05-04 20:20:17 +02:00
# Conformance Item T51
SELECT count(*)
FROM buildings, bridges
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
2014-11-27 21:29:37 +01:00
# Conformance Item T52
SELECT AsText(ConvexHull(shore))
FROM lakes
WHERE lakes.name = 'Blue Lake';
AsText(ConvexHull(shore))
POLYGON((48 6,52 18,66 23,73 9,48 6))
2011-05-04 20:20:17 +02:00
DROP DATABASE gis_ogs;
2013-03-22 14:32:27 +01:00
USE test;
2012-08-31 16:50:45 +02:00
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
2012-09-05 23:14:33 +02:00
0.008148695928146028
2012-08-31 16:50:45 +02:00
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
2012-09-05 23:14:33 +02:00
0.008148695928146028
2011-07-04 13:53:07 +02:00
#
2013-03-22 14:32:27 +01:00
# MDEV-4310 geometry function equals hangs forever.
2012-03-05 18:58:07 +01:00
#
2013-03-22 14:32:27 +01:00
create table t1(a geometry not null)engine=myisam;
insert into t1 values(geomfromtext("POINT(0 0)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
equals(`a`,convert(`a` using utf8))
1
2015-03-18 14:10:48 +01:00
0
0
Warnings:
Warning 1300 Invalid utf8 character string: '\xE0C'
Warning 1300 Invalid utf8 character string: '\xE0C'
select equals(`a`,left(`a`,23)) from `t1`;
equals(`a`,left(`a`,23))
NULL
2012-03-05 18:58:07 +01:00
NULL
2013-03-22 14:32:27 +01:00
NULL
drop table t1;
2014-11-15 18:30:16 +01:00
#
# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
#
select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
st_within(GeomFromText('Polygon((0 0))'), Point(0,0))
1
2013-03-27 10:03:28 +01:00
End of 5.3 tests
2012-03-05 19:36:56 +01:00
#
2011-07-04 13:53:07 +02:00
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
#
CREATE TABLE g1
(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam;
INSERT INTO g1 VALUES (geomfromtext('point(1 1)'));
INSERT INTO g1 VALUES (geomfromtext('point(1 2)'));
FLUSH TABLES;
SELECT 1 FROM g1
FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
;
1
Warnings:
2011-11-03 19:17:05 +01:00
Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?'
2011-07-04 13:53:07 +02:00
Warning 1441 Datetime function: datetime field overflow
2011-11-03 19:17:05 +01:00
Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@'
2011-07-04 13:53:07 +02:00
DROP TABLE g1;
2011-12-05 15:42:45 +01:00
#
# Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE
#
CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255)));
INSERT INTO g1 VALUES ('a'),('a');
SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
1
2015-09-28 10:51:02 +02:00
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
2011-12-05 15:42:45 +01:00
DROP TABLE g1;
2013-02-20 22:03:45 +01:00
#
2013-12-19 11:38:38 +01:00
# Bug#16451878 GEOMETRY QUERY CRASHES SERVER
#
# should not crash
SELECT ASTEXT(0x0100000000030000000100000000000010);
ASTEXT(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT ENVELOPE(0x0100000000030000000100000000000010);
ENVELOPE(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
NULL
2014-02-17 11:00:51 +01:00
#
2013-02-20 22:03:45 +01:00
# MDEV-3819 missing constraints for spatial column types
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
drop table t1;
2015-02-10 13:16:31 +01:00
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
GEOMETRYCOLLECTION EMPTY
2015-04-28 12:31:49 +02:00
CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select point(1,1) AS `p` latin1 latin1_swedish_ci
SELECT ASTEXT(p) FROM v1;
ASTEXT(p)
POINT(1 1)
DROP VIEW v1;
2011-03-09 16:04:52 +01:00
End of 5.5 tests
2014-09-02 08:31:26 +02:00
SHOW CREATE TABLE information_schema.geometry_columns;
Table Create Table
GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` (
`F_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '',
`F_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`F_TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`F_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '',
`G_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '',
`G_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`G_TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`G_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '',
`STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT '0',
`GEOMETRY_TYPE` int(7) NOT NULL DEFAULT '0',
`COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT '0',
`MAX_PPR` tinyint(2) NOT NULL DEFAULT '0',
`SRID` smallint(5) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW CREATE TABLE information_schema.spatial_ref_sys;
Table Create Table
SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` (
`SRID` smallint(5) NOT NULL DEFAULT '0',
`AUTH_NAME` varchar(512) NOT NULL DEFAULT '',
2015-12-21 13:07:07 +01:00
`AUTH_SRID` int(5) NOT NULL DEFAULT '0',
2014-09-02 08:31:26 +02:00
`SRTEXT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
select * from information_schema.geometry_columns;
F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID
2014-12-03 11:07:43 +01:00
def test t1 def test t1 g 1 0 2 0 0
def test t1 def test t1 pt 1 1 2 0 0
def test t2 def test t2 g 1 2 2 0 0
def test t2 def test t2 pl 1 3 2 0 0
2014-09-02 08:31:26 +02:00
drop table t1, t2;
2014-12-03 11:07:43 +01:00
10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1';
SRID
101
0
102
drop table t1;
2015-03-12 10:40:52 +01:00
# Expect an int(1) column to be created
CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CONTAINS(NULL, NULL)` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
2015-03-12 14:50:23 +01:00
#
# MDEV-7334 valgrind warning "unitialized bytes" in 10.1.
#
CREATE TABLE t1 (
gp point,
ln linestring,
pg polygon,
mp multipoint,
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
ALTER TABLE t1 ADD fid INT NOT NULL;
select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1';
SRID
0
0
0
0
0
0
0
0
drop table t1;
2015-03-13 13:10:31 +01:00
#
# MDEV-7510 GIS: IsRing returns false for a primitive triangle.
#
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'))
1
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'))
0
2015-03-15 08:17:50 +01:00
#
# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
#
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')))
2015-03-15 19:20:38 +01:00
NULL
#
# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations
#
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals;
equals
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains;
contains
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within;
within
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint;
disjoint
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
disjoint
0
2015-06-23 08:57:05 +02:00
#
# MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
#
select ST_IsRing(NULL);
ST_IsRing(NULL)
-1
2015-09-11 21:26:02 +02:00
#
# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
#
CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`w1` int(1) DEFAULT NULL,
`w2` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;