| 1 |
create table t1 (c1 int, c2 geometry not null SRID 0, spatial index (c2))engine=innodb; |
| 2 |
create procedure insert_t1(IN total int) |
| 3 |
begin |
| 4 |
declare i int default 1; |
| 5 |
while (i <= total) DO |
| 6 |
insert into t1 values |
| 7 |
(i, Point(i, i)), |
| 8 |
(i + 1, Point(i + 1, i + 1)), |
| 9 |
(i + 2, Point(i + 2, i + 2)), |
| 10 |
(i + 3, Point(i + 3, i + 3)), |
| 11 |
(i + 4, Point(i + 4, i + 4)), |
| 12 |
(i + 5, Point(i + 5, i + 5)), |
| 13 |
(i + 6, Point(i + 6, i + 6)), |
| 14 |
(i + 7, Point(i + 7, i + 7)), |
| 15 |
(i + 8, Point(i + 8, i + 8)), |
| 16 |
(i + 9, Point(i + 9, i + 9)); |
| 17 |
set i = i + 10; |
| 18 |
end while; |
| 19 |
end| |
| 20 |
CALL insert_t1(5000); |
| 21 |
select count(*) from t1; |
| 22 |
count(*) |
| 23 |
5000 |
| 24 |
check table t1; |
| 25 |
Table Op Msg_type Msg_text |
| 26 |
test.t1 check status OK |
| 27 |
truncate table t1; |
| 28 |
CALL insert_t1(10000); |
| 29 |
select count(*) from t1; |
| 30 |
count(*) |
| 31 |
10000 |
| 32 |
drop index c2 on t1; |
| 33 |
create spatial index idx on t1(c2); |
| 34 |
show create table t1; |
| 35 |
Table Create Table |
| 36 |
t1 CREATE TABLE `t1` ( |
| 37 |
`c1` int DEFAULT NULL, |
| 38 |
`c2` geometry NOT NULL /*!80003 SRID 0 */, |
| 39 |
SPATIAL KEY `idx` (`c2`) |
| 40 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 41 |
SET DEBUG='+d,ddl_ins_spatial_fail'; |
| 42 |
create spatial index idx2 on t1(c2); |
| 43 |
ERROR HY000: Got error 1000 - 'InnoDB error' from storage engine |
| 44 |
SET DEBUG='-d,ddl_ins_spatial_fail'; |
| 45 |
show create table t1; |
| 46 |
Table Create Table |
| 47 |
t1 CREATE TABLE `t1` ( |
| 48 |
`c1` int DEFAULT NULL, |
| 49 |
`c2` geometry NOT NULL /*!80003 SRID 0 */, |
| 50 |
SPATIAL KEY `idx` (`c2`) |
| 51 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 52 |
check table t1; |
| 53 |
Table Op Msg_type Msg_text |
| 54 |
test.t1 check status OK |
| 55 |
truncate table t1; |
| 56 |
CALL insert_t1(100000); |
| 57 |
select count(*) from t1; |
| 58 |
count(*) |
| 59 |
100000 |
| 60 |
check table t1; |
| 61 |
Table Op Msg_type Msg_text |
| 62 |
test.t1 check status OK |
| 63 |
truncate table t1; |
| 64 |
drop procedure insert_t1; |
| 65 |
drop table t1; |