@@ -47,10 +47,20 @@ VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,
47
47
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'),
48
48
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
49
49
ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC);
50
+ affected rows: 0
51
+ info: Records: 0 Duplicates: 0 Warnings: 0
50
52
ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC);
53
+ affected rows: 0
54
+ info: Records: 0 Duplicates: 0 Warnings: 0
51
55
ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon';
56
+ affected rows: 0
57
+ info: Records: 0 Duplicates: 0 Warnings: 0
52
58
ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry';
59
+ affected rows: 0
60
+ info: Records: 0 Duplicates: 0 Warnings: 0
53
61
ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE;
62
+ affected rows: 0
63
+ info: Records: 0 Duplicates: 0 Warnings: 0
54
64
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
55
65
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1);
56
66
c1 ST_Astext(c2) ST_Astext(c4)
@@ -140,8 +150,14 @@ c1 ST_Astext(c2) ST_Astext(c4)
140
150
1 POINT(1000 1000) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
141
151
DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1);
142
152
ALTER TABLE tab CHANGE COLUMN c2 c22 POINT NOT NULL;
153
+ affected rows: 0
154
+ info: Records: 0 Duplicates: 0 Warnings: 0
143
155
ALTER TABLE tab CHANGE COLUMN c3 c33 LINESTRING NOT NULL;
156
+ affected rows: 0
157
+ info: Records: 0 Duplicates: 0 Warnings: 0
144
158
ALTER TABLE tab CHANGE COLUMN c4 c44 POLYGON NOT NULL;
159
+ affected rows: 0
160
+ info: Records: 0 Duplicates: 0 Warnings: 0
145
161
SHOW CREATE TABLE tab;
146
162
Table Create Table
147
163
tab CREATE TABLE `tab` (
@@ -166,8 +182,14 @@ tab 1 idx4 1 c44 A # 32 NULL SPATIAL testing spatial index on Polygon
166
182
tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry
167
183
tab 1 idx6 1 c44 A # 10 NULL BTREE
168
184
ALTER TABLE tab CHANGE COLUMN c22 c2 POINT NOT NULL;
185
+ affected rows: 0
186
+ info: Records: 0 Duplicates: 0 Warnings: 0
169
187
ALTER TABLE tab CHANGE COLUMN c33 c3 LINESTRING NOT NULL;
188
+ affected rows: 0
189
+ info: Records: 0 Duplicates: 0 Warnings: 0
170
190
ALTER TABLE tab CHANGE COLUMN c44 c4 POLYGON NOT NULL;
191
+ affected rows: 0
192
+ info: Records: 0 Duplicates: 0 Warnings: 0
171
193
SHOW CREATE TABLE tab;
172
194
Table Create Table
173
195
tab CREATE TABLE `tab` (
@@ -210,7 +232,11 @@ DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
210
232
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1);
211
233
c1 ST_Astext(c2) ST_Astext(c4)
212
234
ALTER TABLE tab DROP PRIMARY KEY;
235
+ affected rows: 4
236
+ info: Records: 4 Duplicates: 0 Warnings: 0
213
237
ALTER TABLE tab ADD PRIMARY KEY(c2) ;
238
+ affected rows: 0
239
+ info: Records: 0 Duplicates: 0 Warnings: 0
214
240
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
215
241
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1);
216
242
c1 ST_Astext(c2) ST_Astext(c4)
@@ -254,7 +280,11 @@ SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) OR
254
280
c1 ST_Astext(c2) ST_Astext(c4)
255
281
INSERT INTO tab SELECT * FROM tab1;
256
282
ALTER TABLE tab DROP PRIMARY KEY;
283
+ affected rows: 1
284
+ info: Records: 1 Duplicates: 0 Warnings: 0
257
285
ALTER TABLE tab DROP INDEX idx2;
286
+ affected rows: 0
287
+ info: Records: 0 Duplicates: 0 Warnings: 0
258
288
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
259
289
CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2;
260
290
INSERT INTO temp_tab SELECT * FROM tab;
@@ -306,8 +336,14 @@ tab 1 idx5 1 c5 A # 32 NULL SPATIAL testing spatial index on Geometry
306
336
tab 1 idx6 1 c4 A # 10 NULL BTREE
307
337
DELETE FROM tab;
308
338
ALTER TABLE tab ADD PRIMARY KEY(c2);
339
+ affected rows: 0
340
+ info: Records: 0 Duplicates: 0 Warnings: 0
309
341
CREATE SPATIAL INDEX idx2 ON tab(c2 ASC);
342
+ affected rows: 0
343
+ info: Records: 0 Duplicates: 0 Warnings: 0
310
344
ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c2);
345
+ affected rows: 0
346
+ info: Records: 0 Duplicates: 0 Warnings: 0
311
347
SHOW CREATE TABLE tab;
312
348
Table Create Table
313
349
tab CREATE TABLE `tab` (
@@ -339,9 +375,17 @@ ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
339
375
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
340
376
DELETE FROM tab;
341
377
ALTER TABLE tab DROP PRIMARY KEY ;
378
+ affected rows: 0
379
+ info: Records: 0 Duplicates: 0 Warnings: 0
342
380
ALTER TABLE tab DROP KEY const_1;
381
+ affected rows: 0
382
+ info: Records: 0 Duplicates: 0 Warnings: 0
343
383
ALTER TABLE tab ADD PRIMARY KEY(c5(10));
384
+ affected rows: 0
385
+ info: Records: 0 Duplicates: 0 Warnings: 0
344
386
ALTER TABLE tab ADD CONSTRAINT const_1 UNIQUE(c5(10));
387
+ affected rows: 0
388
+ info: Records: 0 Duplicates: 0 Warnings: 0
345
389
SHOW CREATE TABLE tab;
346
390
Table Create Table
347
391
tab CREATE TABLE `tab` (
@@ -419,13 +463,25 @@ ANALYZE TABLE tab;
419
463
Table Op Msg_type Msg_text
420
464
test.tab analyze status OK
421
465
ALTER TABLE tab ADD SPATIAL INDEX idx2(c2 ASC);
466
+ affected rows: 0
467
+ info: Records: 0 Duplicates: 0 Warnings: 0
422
468
ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC);
469
+ affected rows: 0
470
+ info: Records: 0 Duplicates: 0 Warnings: 0
423
471
ALTER TABLE tab ADD SPATIAL INDEX idx4(c4 ASC) COMMENT 'testing spatial index on Polygon';
472
+ affected rows: 0
473
+ info: Records: 0 Duplicates: 0 Warnings: 0
424
474
ALTER TABLE tab ADD SPATIAL KEY idx5(c5 ASC) COMMENT 'testing spatial index on Geometry';
475
+ affected rows: 0
476
+ info: Records: 0 Duplicates: 0 Warnings: 0
425
477
ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE;
478
+ affected rows: 0
479
+ info: Records: 0 Duplicates: 0 Warnings: 0
426
480
ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL;
481
+ affected rows: 0
482
+ info: Records: 0 Duplicates: 0 Warnings: 0
427
483
ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE;
428
- ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Do not support online operation on table with GIS index. Try ALGORITHM=COPY
484
+ ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
429
485
SHOW CREATE TABLE tab;
430
486
Table Create Table
431
487
tab CREATE TABLE `tab` (
@@ -459,6 +515,8 @@ DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
459
515
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
460
516
c1 ST_Astext(c2) ST_Astext(c4)
461
517
ALTER TABLE tab MODIFY COLUMN c4 GEOMETRY NOT NULL;
518
+ affected rows: 0
519
+ info: Records: 0 Duplicates: 0 Warnings: 0
462
520
SHOW CREATE TABLE tab;
463
521
Table Create Table
464
522
tab CREATE TABLE `tab` (
@@ -507,8 +565,14 @@ test.tab analyze status OK
507
565
SET @g1 = ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))');
508
566
SET @g2 = ST_GeomFromText('LINESTRING(1 1,2 2,3 3)');
509
567
ALTER TABLE tab MODIFY COLUMN c2 POINT NOT NULL;
568
+ affected rows: 8
569
+ info: Records: 8 Duplicates: 0 Warnings: 0
510
570
ALTER TABLE tab MODIFY COLUMN c3 LINESTRING NOT NULL;
571
+ affected rows: 0
572
+ info: Records: 0 Duplicates: 0 Warnings: 0
511
573
ALTER TABLE tab MODIFY COLUMN c4 POLYGON NOT NULL;
574
+ affected rows: 8
575
+ info: Records: 8 Duplicates: 0 Warnings: 0
512
576
SHOW CREATE TABLE tab;
513
577
Table Create Table
514
578
tab CREATE TABLE `tab` (
@@ -585,7 +649,11 @@ DROP TABLE tab;
585
649
CREATE TABLE parent (id POINT, PRIMARY KEY(id)) ENGINE=InnoDB;
586
650
CREATE TABLE child (id GEOMETRY NOT NULL, parent_id POINT NOT NULL) ENGINE=InnoDB;
587
651
ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC);
652
+ affected rows: 0
653
+ info: Records: 0 Duplicates: 0 Warnings: 0
588
654
ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC);
655
+ affected rows: 0
656
+ info: Records: 0 Duplicates: 0 Warnings: 0
589
657
SHOW CREATE TABLE parent;
590
658
Table Create Table
591
659
parent CREATE TABLE `parent` (
@@ -613,7 +681,11 @@ DROP table child,parent;
613
681
CREATE TABLE parent (id GEOMETRY, PRIMARY KEY(id(10))) ENGINE=InnoDB;
614
682
CREATE TABLE child (id GEOMETRY NOT NULL, parent_id GEOMETRY NOT NULL) ENGINE=InnoDB;
615
683
ALTER TABLE parent ADD SPATIAL INDEX idx1(id ASC) ;
684
+ affected rows: 0
685
+ info: Records: 0 Duplicates: 0 Warnings: 0
616
686
ALTER TABLE child ADD SPATIAL INDEX idx2(parent_id ASC);
687
+ affected rows: 0
688
+ info: Records: 0 Duplicates: 0 Warnings: 0
617
689
SHOW CREATE TABLE parent;
618
690
Table Create Table
619
691
parent CREATE TABLE `parent` (
@@ -641,23 +713,21 @@ create table t1 (c1 int) engine=innodb;
641
713
insert into t1 values(NULL);
642
714
alter table t1 add b geometry, add spatial index(b), algorithm=inplace;
643
715
ERROR 42000: All parts of a SPATIAL index must be NOT NULL
644
- alter table t1 add b geometry, algorithm=inplace;
645
- update t1 set b = st_geomfromtext('point(0 0)');
646
- alter table t1 add spatial index(b), algorithm=inplace;
647
- ERROR 42000: All parts of a SPATIAL index must be NOT NULL
648
- delete from t1;
716
+ alter table t1 add b geometry not null, add spatial index(b), algorithm=inplace;
717
+ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
718
+ alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'),
719
+ add spatial index(b), algorithm=inplace;
720
+ affected rows: 0
721
+ info: Records: 0 Duplicates: 0 Warnings: 0
649
722
DROP table t1;
650
723
create table t1 (c1 int) engine=innodb;
651
724
insert into t1 values(NULL);
652
725
alter table t1 add b geometry, add spatial index(b), algorithm=copy;
653
726
ERROR 42000: All parts of a SPATIAL index must be NOT NULL
654
727
alter table t1 add b geometry not null, add spatial index(b), algorithm=copy;
655
728
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
656
- update t1 set b = st_geomfromtext('point(0 0)');
657
- ERROR 42S22: Unknown column 'b' in 'field list'
658
- alter table t1 add spatial index(b), algorithm=copy;
659
- ERROR 42000: Key column 'b' doesn't exist in table
660
- delete from t1;
729
+ alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'),
730
+ add spatial index(b), algorithm=copy;
661
731
DROP table t1;
662
732
#
663
733
# BUG#20111575 ALTER TABLE...ADD SPATIAL INDEX...LOCK NONE IS REFUSED
0 commit comments