1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
-- source include/have_geometry.inc
if (!$HA_ARCHIVE_SO) {
skip Needs Archive plugin;
}
--echo #
--echo # MDEV-19177: Geometry support for partition feature
--echo # Test partition/geometry type cross-compatibility for the 4 storage engines that support
--echo # geometries (Aria, MyISAM, InnoDB, Archive)
--echo # Geometries to test - point, multipolygon, geometry collection
--echo # Note: Archive does not support additional indices.
--echo #
SET @point = Point(3,3);
SET @poly = MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))));
SET @collection = GeometryCollection(Point(1,1), Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))));
--source include/have_partition.inc
--echo #
--echo # Aria engine
--echo #
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=Aria PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MyISAM engine
--echo #
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=myisam PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # InnoDB engine
--echo #
--source include/have_innodb.inc
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=innodb PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Archive engine
--echo #
INSTALL SONAME 'ha_archive';
--error ER_TABLE_CANT_HANDLE_SPKEYS
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry,
SPATIAL INDEX(geom)
) Engine=archive PARTITION BY HASH (id)
PARTITIONS 10;
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry,
PRIMARY KEY (id)
) Engine=archive PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
UNINSTALL SONAME 'ha_archive';
|