118 changed files with 7687 additions and 700 deletions
-
1mysql-test/Makefile.am
-
2mysql-test/mysql-test-run.pl
-
0mysql-test/suite/innodb/r/innodb-autoinc-optimize.result
-
0mysql-test/suite/innodb/r/innodb-ucs2.result
-
0mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result
-
0mysql-test/suite/innodb/r/innodb_bug30919.result
-
0mysql-test/suite/innodb/r/innodb_bug42419.result
-
11mysql-test/suite/innodb/r/innodb_bug53674.result
-
3mysql-test/suite/innodb/r/innodb_bug54044.result
-
0mysql-test/suite/innodb/r/innodb_gis.result
-
0mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
-
12mysql-test/suite/innodb/r/innodb_mysql.result
-
0mysql-test/suite/innodb/r/innodb_mysql_rbk.result
-
0mysql-test/suite/innodb/r/innodb_notembedded.result
-
0mysql-test/suite/innodb/r/innodb_timeout_rollback.result
-
1mysql-test/suite/innodb/t/disabled.def
-
0mysql-test/suite/innodb/t/innodb-autoinc-optimize.test
-
0mysql-test/suite/innodb/t/innodb-ucs2.test
-
0mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt
-
0mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test
-
0mysql-test/suite/innodb/t/innodb_bug30919-master.opt
-
0mysql-test/suite/innodb/t/innodb_bug30919.test
-
0mysql-test/suite/innodb/t/innodb_bug42419.test
-
1mysql-test/suite/innodb/t/innodb_bug53674-master.opt
-
8mysql-test/suite/innodb/t/innodb_bug53674.test
-
11mysql-test/suite/innodb/t/innodb_bug54044.test
-
0mysql-test/suite/innodb/t/innodb_gis.test
-
0mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt
-
0mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
-
0mysql-test/suite/innodb/t/innodb_mysql-master.opt
-
15mysql-test/suite/innodb/t/innodb_mysql.test
-
0mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt
-
0mysql-test/suite/innodb/t/innodb_mysql_rbk.test
-
0mysql-test/suite/innodb/t/innodb_notembedded.test
-
0mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt
-
0mysql-test/suite/innodb/t/innodb_timeout_rollback.test
-
9mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result
-
314mysql-test/suite/innodb_plugin/r/innodb-ucs2.result
-
39mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result
-
1043mysql-test/suite/innodb_plugin/r/innodb_bug30919.result
-
17mysql-test/suite/innodb_plugin/r/innodb_bug42419.result
-
11mysql-test/suite/innodb_plugin/r/innodb_bug53674.result
-
3mysql-test/suite/innodb_plugin/r/innodb_bug54044.result
-
91mysql-test/suite/innodb_plugin/r/innodb_bug54679.result
-
589mysql-test/suite/innodb_plugin/r/innodb_gis.result
-
375mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result
-
2393mysql-test/suite/innodb_plugin/r/innodb_mysql.result
-
21mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result
-
23mysql-test/suite/innodb_plugin/r/innodb_notembedded.result
-
36mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result
-
1mysql-test/suite/innodb_plugin/t/disabled.def
-
19mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test
-
230mysql-test/suite/innodb_plugin/t/innodb-ucs2.test
-
1mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt
-
44mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test
-
1mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt
-
68mysql-test/suite/innodb_plugin/t/innodb_bug30919.test
-
78mysql-test/suite/innodb_plugin/t/innodb_bug42419.test
-
2mysql-test/suite/innodb_plugin/t/innodb_bug53592.test
-
1mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt
-
8mysql-test/suite/innodb_plugin/t/innodb_bug53674.test
-
11mysql-test/suite/innodb_plugin/t/innodb_bug54044.test
-
97mysql-test/suite/innodb_plugin/t/innodb_bug54679.test
-
10mysql-test/suite/innodb_plugin/t/innodb_gis.test
-
1mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt
-
264mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test
-
2mysql-test/suite/innodb_plugin/t/innodb_multi_update.test
-
1mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt
-
635mysql-test/suite/innodb_plugin/t/innodb_mysql.test
-
1mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt
-
35mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test
-
50mysql-test/suite/innodb_plugin/t/innodb_notembedded.test
-
1mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt
-
5mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test
-
4mysql-test/t/ps_3innodb.test
-
10storage/innobase/dict/dict0dict.c
-
36storage/innobase/handler/ha_innodb.cc
-
2storage/innobase/include/db0err.h
-
12storage/innobase/include/lock0lock.h
-
43storage/innobase/include/row0mysql.h
-
2storage/innobase/include/sync0sync.h
-
138storage/innobase/lock/lock0lock.c
-
146storage/innobase/row/row0ins.c
-
20storage/innobase/row/row0mysql.c
-
130storage/innobase/row/row0sel.c
-
4storage/innobase/row/row0undo.c
-
74storage/innodb_plugin/ChangeLog
-
10storage/innodb_plugin/btr/btr0cur.c
-
1storage/innodb_plugin/btr/btr0sea.c
-
2storage/innodb_plugin/buf/buf0buf.c
-
18storage/innodb_plugin/dict/dict0crea.c
-
44storage/innodb_plugin/dict/dict0dict.c
-
8storage/innodb_plugin/dict/dict0load.c
-
4storage/innodb_plugin/dict/dict0mem.c
-
35storage/innodb_plugin/fil/fil0fil.c
-
193storage/innodb_plugin/handler/ha_innodb.cc
-
2storage/innodb_plugin/include/db0err.h
-
2storage/innodb_plugin/include/dict0mem.h
-
10storage/innodb_plugin/include/fil0fil.h
-
12storage/innodb_plugin/include/lock0lock.h
@ -0,0 +1,11 @@ |
|||
create table bug53674(a int)engine=innodb; |
|||
insert into bug53674 values (1),(2); |
|||
start transaction; |
|||
select * from bug53674 for update; |
|||
a |
|||
1 |
|||
2 |
|||
select * from bug53674 where a=(select a from bug53674 where a > 1); |
|||
a |
|||
2 |
|||
drop table bug53674; |
|||
@ -0,0 +1,3 @@ |
|||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB |
|||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL); |
|||
ERROR HY000: Can't create table 'test.table_54044' (errno: -1) |
|||
@ -0,0 +1 @@ |
|||
--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed |
|||
@ -0,0 +1,8 @@ |
|||
-- source include/have_innodb.inc |
|||
|
|||
create table bug53674(a int)engine=innodb; |
|||
insert into bug53674 values (1),(2); |
|||
start transaction; |
|||
select * from bug53674 for update; |
|||
select * from bug53674 where a=(select a from bug53674 where a > 1); |
|||
drop table bug53674; |
|||
@ -0,0 +1,11 @@ |
|||
# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type |
|||
# during create table, so it will not trigger assertion failure. |
|||
|
|||
--source include/have_innodb.inc |
|||
|
|||
# This 'create table' operation should fail because of |
|||
# using NULL datatype |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB |
|||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL); |
|||
|
|||
@ -0,0 +1,9 @@ |
|||
drop table if exists t1; |
|||
create table t1(a int not null auto_increment primary key) engine=innodb; |
|||
insert into t1 set a = -1; |
|||
optimize table t1; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead |
|||
test.t1 optimize status OK |
|||
==== clean up ==== |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,314 @@ |
|||
drop table if exists t1, t2; |
|||
create table t1 ( |
|||
a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
a hex(b) hex(c) filler |
|||
1 61626364656667 61626364656667 boo |
|||
4 D0B1 D0B1 eight |
|||
4 5B 5B five |
|||
4 E880BD E880BD four |
|||
4 E880BDD0B1E880BD E880BDD0B1E880BD seven |
|||
4 E880BDE880BD E880BDE880BD six |
|||
3 71727374757677 71727374757677 three |
|||
2 696A6B696C6D6E 696A6B696C6D6E two |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
a hex(b) hex(c) filler |
|||
4 05630563 05630563 email |
|||
4 0563 0563 email |
|||
4 05612020 05612020 email |
|||
4 01FC 01FC email |
|||
4 0120 0120 email |
|||
4 00640065 00640065 email |
|||
4 00E400E50068 00E400E50068 email |
|||
4 0000E400 0000E400 email |
|||
4 0000563001FC0563 0000563001FC0563 email |
|||
1 0061006200630064006500660067 0061006200630064006500660067 one |
|||
3 0071007200730074007500760077 0071007200730074007500760077 three |
|||
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two |
|||
drop table t1; |
|||
drop table t2; |
|||
create table t1 ( |
|||
a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
a hex(b) hex(c) filler |
|||
1 61626364656667 61626364656667 boo |
|||
4 D0B1 D0B1 eight |
|||
4 5B 5B five |
|||
4 E880BD E880BD four |
|||
4 E880BDD0B1E880BD E880BDD0B1E880BD seven |
|||
4 E880BDE880BD E880BDE880BD six |
|||
3 71727374757677 71727374757677 three |
|||
2 696A6B696C6D6E 696A6B696C6D6E two |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
a hex(b) hex(c) filler |
|||
4 05630563 05630563 email |
|||
4 0563 0563 email |
|||
4 05612020 05612020 email |
|||
4 01FC 01FC email |
|||
4 0120 0120 email |
|||
4 00640065 00640065 email |
|||
4 00E400E50068 00E400E50068 email |
|||
4 0000E400 0000E400 email |
|||
4 0000563001FC0563 0000563001FC0563 email |
|||
1 0061006200630064006500660067 0061006200630064006500660067 one |
|||
3 0071007200730074007500760077 0071007200730074007500760077 three |
|||
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two |
|||
drop table t1; |
|||
drop table t2; |
|||
create table t1 ( |
|||
a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
a hex(b) hex(c) filler |
|||
1 61626364656667 61626364656667 boo |
|||
4 D0B1 D0B1 eight |
|||
4 5B 5B five |
|||
4 E880BD E880BD four |
|||
4 E880BDD0B1E880BD E880BDD0B1E880BD seven |
|||
4 E880BDE880BD E880BDE880BD six |
|||
3 71727374757677 71727374757677 three |
|||
2 696A6B696C6D6E 696A6B696C6D6E two |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
a hex(b) hex(c) filler |
|||
4 0120 0120 email |
|||
4 01FC 01FC email |
|||
4 0563 0563 email |
|||
4 0000563001FC0563 0000563001FC0563 email |
|||
4 0000E400 0000E400 email |
|||
4 00640065 00640065 email |
|||
4 00E400E50068 00E400E50068 email |
|||
4 05612020 05612020 email |
|||
4 05630563 05630563 email |
|||
1 0061006200630064006500660067 0061006200630064006500660067 one |
|||
3 0071007200730074007500760077 0071007200730074007500760077 three |
|||
2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two |
|||
drop table t1; |
|||
drop table t2; |
|||
create table t1 ( |
|||
a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
a hex(b) hex(c) filler |
|||
1 61626364656667 61626364656667 boo |
|||
4 D0B1 D0B1 eight |
|||
4 5B 5B five |
|||
4 E880BD E880BD four |
|||
3 71727374757677 71727374757677 three |
|||
2 696A6B696C6D6E 696A6B696C6D6E two |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
a hex(b) hex(c) filler |
|||
4 0000E400 0000E400 email |
|||
4 00640065 00640065 email |
|||
4 00E400E50068 00E400E50068 email |
|||
4 0120 0120 email |
|||
4 01FC 01FC email |
|||
4 05612020 05612020 email |
|||
4 0563 0563 email |
|||
1 61626364656667 61626364656667 one |
|||
3 71727374757677 71727374757677 three |
|||
2 696A6B696C6D6E 696A6B696C6D6E two |
|||
drop table t1; |
|||
drop table t2; |
|||
commit; |
|||
CREATE TABLE t1 ( |
|||
ind enum('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind enum('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
INSERT INTO t1 VALUES ('1', ''),('2', ''); |
|||
INSERT INTO t2 VALUES ('1', ''),('2', ''); |
|||
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; |
|||
hex(ind) hex(string1) |
|||
31 |
|||
32 |
|||
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; |
|||
hex(ind) hex(string1) |
|||
0031 |
|||
0032 |
|||
drop table t1,t2; |
|||
CREATE TABLE t1 ( |
|||
ind set('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind set('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
INSERT INTO t1 VALUES ('1', ''),('2', ''); |
|||
INSERT INTO t2 VALUES ('1', ''),('2', ''); |
|||
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; |
|||
hex(ind) hex(string1) |
|||
31 |
|||
32 |
|||
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; |
|||
hex(ind) hex(string1) |
|||
0031 |
|||
0032 |
|||
drop table t1,t2; |
|||
CREATE TABLE t1 ( |
|||
ind bit not null, |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind bit not null, |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
insert into t1 values(0,''),(1,''); |
|||
insert into t2 values(0,''),(1,''); |
|||
select hex(ind),hex(string1) from t1 order by string1; |
|||
hex(ind) hex(string1) |
|||
0 |
|||
1 |
|||
select hex(ind),hex(string1) from t2 order by string1; |
|||
hex(ind) hex(string1) |
|||
0 |
|||
1 |
|||
drop table t1,t2; |
|||
create table t2 ( |
|||
a int, b char(10), filler char(10), primary key(a, b(2)) |
|||
) character set utf8 engine = innodb; |
|||
insert into t2 values (1,'abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','two'); |
|||
insert into t2 values (3, 'qrstuvw','three'); |
|||
update t2 set a=5, filler='booo' where a=1; |
|||
drop table t2; |
|||
create table t2 ( |
|||
a int, b char(10), filler char(10), primary key(a, b(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t2 values (1,'abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','two'); |
|||
insert into t2 values (3, 'qrstuvw','three'); |
|||
update t2 set a=5, filler='booo' where a=1; |
|||
drop table t2; |
|||
create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; |
|||
insert into t1 values(1,'abcdefg'),(2,'defghijk'); |
|||
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); |
|||
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); |
|||
select a,hex(b) from t1 order by b; |
|||
a hex(b) |
|||
1 61626364656667 |
|||
2 6465666768696A6B |
|||
6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 |
|||
7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 |
|||
update t1 set b = 'three' where a = 6; |
|||
drop table t1; |
|||
create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; |
|||
insert into t1 values(1,'abcdefg'),(2,'defghijk'); |
|||
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); |
|||
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); |
|||
select a,hex(b) from t1 order by b; |
|||
a hex(b) |
|||
1 61626364656667 |
|||
2 6465666768696A6B |
|||
6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1 |
|||
7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2 |
|||
update t1 set b = 'three' where a = 6; |
|||
drop table t1; |
|||
End of 5.0 tests |
|||
@ -0,0 +1,39 @@ |
|||
drop table if exists t1; |
|||
CREATE TABLE t1 ( |
|||
id int(11) NOT NULL auto_increment, |
|||
ggid varchar(32) binary DEFAULT '' NOT NULL, |
|||
email varchar(64) DEFAULT '' NOT NULL, |
|||
passwd varchar(32) binary DEFAULT '' NOT NULL, |
|||
PRIMARY KEY (id), |
|||
UNIQUE ggid (ggid) |
|||
) ENGINE=innodb; |
|||
insert into t1 (ggid,passwd) values ('test1','xxx'); |
|||
insert into t1 (ggid,passwd) values ('test2','yyy'); |
|||
insert into t1 (ggid,passwd) values ('test2','this will fail'); |
|||
ERROR 23000: Duplicate entry 'test2' for key 'ggid' |
|||
insert into t1 (ggid,id) values ('this will fail',1); |
|||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
|||
select * from t1 where ggid='test1'; |
|||
id ggid email passwd |
|||
1 test1 xxx |
|||
select * from t1 where passwd='xxx'; |
|||
id ggid email passwd |
|||
1 test1 xxx |
|||
select * from t1 where id=2; |
|||
id ggid email passwd |
|||
2 test2 yyy |
|||
replace into t1 (ggid,id) values ('this will work',1); |
|||
replace into t1 (ggid,passwd) values ('test2','this will work'); |
|||
update t1 set id=100,ggid='test2' where id=1; |
|||
ERROR 23000: Duplicate entry 'test2' for key 'ggid' |
|||
select * from t1; |
|||
id ggid email passwd |
|||
1 this will work |
|||
3 test2 this will work |
|||
select * from t1 where id=1; |
|||
id ggid email passwd |
|||
1 this will work |
|||
select * from t1 where id=999; |
|||
id ggid email passwd |
|||
drop table t1; |
|||
End of tests |
|||
1043
mysql-test/suite/innodb_plugin/r/innodb_bug30919.result
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,17 @@ |
|||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB; |
|||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3); |
|||
COMMIT; |
|||
SET AUTOCOMMIT = 0; |
|||
CREATE TEMPORARY TABLE t1_tmp ( b INT ); |
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3; |
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2; |
|||
SET AUTOCOMMIT = 0; |
|||
CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int ); |
|||
INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53); |
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1; |
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2; |
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1; |
|||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
|||
Reap the server message for connection user2 UPDATE t1 ... |
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3; |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,11 @@ |
|||
create table bug53674(a int)engine=innodb; |
|||
insert into bug53674 values (1),(2); |
|||
start transaction; |
|||
select * from bug53674 for update; |
|||
a |
|||
1 |
|||
2 |
|||
select * from bug53674 where a=(select a from bug53674 where a > 1); |
|||
a |
|||
2 |
|||
drop table bug53674; |
|||
@ -0,0 +1,3 @@ |
|||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB |
|||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL); |
|||
ERROR HY000: Can't create table 'test.table_54044' (errno: -1) |
|||
@ -0,0 +1,91 @@ |
|||
SET GLOBAL innodb_file_format='Barracuda'; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
SET innodb_strict_mode=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=COMPRESSED |
|||
ALTER TABLE bug54679 ADD COLUMN b INT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=COMPRESSED |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compact |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed KEY_BLOCK_SIZE=1 |
|||
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Redundant row_format=REDUNDANT |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=REDUNDANT KEY_BLOCK_SIZE=2 |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. |
|||
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. |
|||
Error 1005 Can't create table 'test.bug54679' (errno: 1478) |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SET GLOBAL innodb_file_format=Barracuda; |
|||
SET GLOBAL innodb_file_per_table=OFF; |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. |
|||
Error 1005 Can't create table 'test.bug54679' (errno: 1478) |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
DROP TABLE bug54679; |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
SET GLOBAL innodb_file_format_check=Antelope; |
|||
SET GLOBAL innodb_file_per_table=0; |
|||
@ -0,0 +1,589 @@ |
|||
SET storage_engine=innodb; |
|||
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; |
|||
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); |
|||
CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); |
|||
CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); |
|||
CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); |
|||
CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); |
|||
CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); |
|||
CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); |
|||
CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); |
|||
SHOW CREATE TABLE gis_point; |
|||
Table Create Table |
|||
gis_point CREATE TABLE `gis_point` ( |
|||
`fid` int(11) NOT NULL AUTO_INCREMENT, |
|||
`g` point DEFAULT NULL, |
|||
PRIMARY KEY (`fid`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|||
SHOW FIELDS FROM gis_point; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g point YES NULL |
|||
SHOW FIELDS FROM gis_line; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g linestring YES NULL |
|||
SHOW FIELDS FROM gis_polygon; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g polygon YES NULL |
|||
SHOW FIELDS FROM gis_multi_point; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g multipoint YES NULL |
|||
SHOW FIELDS FROM gis_multi_line; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g multilinestring YES NULL |
|||
SHOW FIELDS FROM gis_multi_polygon; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g multipolygon YES NULL |
|||
SHOW FIELDS FROM gis_geometrycollection; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g geometrycollection YES NULL |
|||
SHOW FIELDS FROM gis_geometry; |
|||
Field Type Null Key Default Extra |
|||
fid int(11) NO PRI NULL auto_increment |
|||
g geometry YES NULL |
|||
INSERT INTO gis_point VALUES |
|||
(101, PointFromText('POINT(10 10)')), |
|||
(102, PointFromText('POINT(20 10)')), |
|||
(103, PointFromText('POINT(20 20)')), |
|||
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); |
|||
INSERT INTO gis_line VALUES |
|||
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), |
|||
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), |
|||
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); |
|||
INSERT INTO gis_polygon VALUES |
|||
(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))')), |
|||
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); |
|||
INSERT INTO gis_multi_point VALUES |
|||
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), |
|||
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), |
|||
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); |
|||
INSERT INTO gis_multi_line VALUES |
|||
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), |
|||
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), |
|||
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); |
|||
INSERT INTO gis_multi_polygon VALUES |
|||
(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)))')), |
|||
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); |
|||
INSERT INTO gis_geometrycollection VALUES |
|||
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), |
|||
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); |
|||
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 ORDER by fid; |
|||
fid AsText(g) |
|||
101 POINT(10 10) |
|||
102 POINT(20 10) |
|||
103 POINT(20 20) |
|||
104 POINT(10 20) |
|||
SELECT fid, AsText(g) FROM gis_line ORDER by fid; |
|||
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) |
|||
SELECT fid, AsText(g) FROM gis_polygon ORDER by fid; |
|||
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)) |
|||
SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid; |
|||
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) |
|||
SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid; |
|||
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)) |
|||
SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid; |
|||
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))) |
|||
SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid; |
|||
fid AsText(g) |
|||
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) |
|||
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) |
|||
SELECT fid, AsText(g) FROM gis_geometry ORDER by fid; |
|||
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)) |
|||
SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid; |
|||
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 |
|||
SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid; |
|||
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 |
|||
SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid; |
|||
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 |
|||
SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid; |
|||
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)) |
|||
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; |
|||
id select_type table type possible_keys key key_len ref rows filtered Extra |
|||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00 |
|||
Warnings: |
|||
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` |
|||
SELECT fid, X(g) FROM gis_point ORDER by fid; |
|||
fid X(g) |
|||
101 10 |
|||
102 20 |
|||
103 20 |
|||
104 10 |
|||
SELECT fid, Y(g) FROM gis_point ORDER by fid; |
|||
fid Y(g) |
|||
101 10 |
|||
102 10 |
|||
103 20 |
|||
104 20 |
|||
explain extended select X(g),Y(g) FROM gis_point; |
|||
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 |
|||
Warnings: |
|||
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` |
|||
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid; |
|||
fid AsText(StartPoint(g)) |
|||
105 POINT(0 0) |
|||
106 POINT(10 10) |
|||
107 POINT(10 10) |
|||
SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid; |
|||
fid AsText(EndPoint(g)) |
|||
105 POINT(10 0) |
|||
106 POINT(10 10) |
|||
107 POINT(40 10) |
|||
SELECT fid, GLength(g) FROM gis_line ORDER by fid; |
|||
fid GLength(g) |
|||
105 24.142135623731 |
|||
106 40 |
|||
107 30 |
|||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid; |
|||
fid NumPoints(g) |
|||
105 3 |
|||
106 5 |
|||
107 2 |
|||
SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid; |
|||
fid AsText(PointN(g, 2)) |
|||
105 POINT(0 10) |
|||
106 POINT(20 10) |
|||
107 POINT(40 10) |
|||
SELECT fid, IsClosed(g) FROM gis_line ORDER by fid; |
|||
fid IsClosed(g) |
|||
105 0 |
|||
106 1 |
|||
107 0 |
|||
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; |
|||
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 |
|||
Warnings: |
|||
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` |
|||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid; |
|||
fid AsText(Centroid(g)) |
|||
108 POINT(15 15) |
|||
109 POINT(25.4166666666667 25.4166666666667) |
|||
110 POINT(20 10) |
|||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid; |
|||
fid Area(g) |
|||
108 100 |
|||
109 2400 |
|||
110 450 |
|||
SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid; |
|||
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) |
|||
SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid; |
|||
fid NumInteriorRings(g) |
|||
108 0 |
|||
109 1 |
|||
110 0 |
|||
SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid; |
|||
fid AsText(InteriorRingN(g, 1)) |
|||
108 NULL |
|||
109 LINESTRING(10 10,20 10,20 20,10 20,10 10) |
|||
110 NULL |
|||
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; |
|||
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 |
|||
Warnings: |
|||
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` |
|||
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid; |
|||
fid IsClosed(g) |
|||
114 0 |
|||
115 0 |
|||
116 0 |
|||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid; |
|||
fid AsText(Centroid(g)) |
|||
117 POINT(55.5885277530424 17.426536064114) |
|||
118 POINT(55.5885277530424 17.426536064114) |
|||
119 POINT(2 2) |
|||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid; |
|||
fid Area(g) |
|||
117 1684.5 |
|||
118 1684.5 |
|||
119 4.5 |
|||
SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid; |
|||
fid NumGeometries(g) |
|||
111 4 |
|||
112 4 |
|||
113 2 |
|||
SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid; |
|||
fid NumGeometries(g) |
|||
114 2 |
|||
115 1 |
|||
116 2 |
|||
SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid; |
|||
fid NumGeometries(g) |
|||
117 2 |
|||
118 2 |
|||
119 1 |
|||
SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid; |
|||
fid NumGeometries(g) |
|||
120 2 |
|||
121 2 |
|||
explain extended SELECT fid, NumGeometries(g) from gis_multi_point; |
|||
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 |
|||
Warnings: |
|||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` |
|||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid; |
|||
fid AsText(GeometryN(g, 2)) |
|||
111 POINT(10 10) |
|||
112 POINT(11 11) |
|||
113 POINT(4 10) |
|||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid; |
|||
fid AsText(GeometryN(g, 2)) |
|||
114 LINESTRING(16 0,16 23,16 48) |
|||
115 NULL |
|||
116 LINESTRING(2 5,5 8,21 7) |
|||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid; |
|||
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 |
|||
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid; |
|||
fid AsText(GeometryN(g, 2)) |
|||
120 LINESTRING(0 0,10 10) |
|||
121 LINESTRING(3 6,7 9) |
|||
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid; |
|||
fid AsText(GeometryN(g, 1)) |
|||
120 POINT(0 0) |
|||
121 POINT(44 6) |
|||
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; |
|||
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 |
|||
Warnings: |
|||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` |
|||
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 |
|||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; |
|||
first second w c o e d t i r |
|||
120 120 1 1 0 1 0 0 1 0 |
|||
120 121 0 0 1 0 0 0 1 0 |
|||
121 120 0 0 1 0 0 0 1 0 |
|||
121 121 1 1 0 1 0 0 1 0 |
|||
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 |
|||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; |
|||
id select_type table type possible_keys key key_len ref rows filtered Extra |
|||
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort |
|||
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer |
|||
Warnings: |
|||
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,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` |
|||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; |
|||
CREATE TABLE t1 ( |
|||
a INTEGER PRIMARY KEY AUTO_INCREMENT, |
|||
gp point, |
|||
ln linestring, |
|||
pg polygon, |
|||
mp multipoint, |
|||
mln multilinestring, |
|||
mpg multipolygon, |
|||
gc geometrycollection, |
|||
gm geometry |
|||
); |
|||
SHOW FIELDS FROM t1; |
|||
Field Type Null Key Default Extra |
|||
a int(11) NO PRI NULL auto_increment |
|||
gp point YES NULL |
|||
ln linestring YES NULL |
|||
pg polygon YES NULL |
|||
mp multipoint YES NULL |
|||
mln multilinestring YES NULL |
|||
mpg multipolygon YES NULL |
|||
gc geometrycollection YES NULL |
|||
gm geometry YES NULL |
|||
ALTER TABLE t1 ADD fid INT; |
|||
SHOW FIELDS FROM t1; |
|||
Field Type Null Key Default Extra |
|||
a int(11) NO PRI NULL auto_increment |
|||
gp point YES NULL |
|||
ln linestring YES NULL |
|||
pg polygon YES NULL |
|||
mp multipoint YES NULL |
|||
mln multilinestring YES NULL |
|||
mpg multipolygon YES NULL |
|||
gc geometrycollection YES NULL |
|||
gm geometry YES NULL |
|||
fid int(11) YES NULL |
|||
DROP TABLE t1; |
|||
create table t1 (pk integer primary key auto_increment, a geometry not null); |
|||
insert into t1 (a) values (GeomFromText('Point(1 2)')); |
|||
insert into t1 (a) values ('Garbage'); |
|||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
|||
insert IGNORE into t1 (a) values ('Garbage'); |
|||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
|||
drop table t1; |
|||
create table t1 (pk integer primary key auto_increment, fl geometry not null); |
|||
insert into t1 (fl) values (1); |
|||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
|||
insert into t1 (fl) values (1.11); |
|||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
|||
insert into t1 (fl) values ("qwerty"); |
|||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
|||
insert into t1 (fl) values (pointfromtext('point(1,1)')); |
|||
ERROR 23000: Column 'fl' cannot be null |
|||
drop table t1; |
|||
End of 4.1 tests |
|||
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 |
|||
down2,left2,right2,up2 |
|||
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 |
|||
down2,left2,right2,up2 |
|||
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; |
|||
End of 5.0 tests |
|||
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 ref p p 28 const 1 Using where |
|||
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 |
|||
1 SIMPLE t2 ref p p 28 const 1 Using where |
|||
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 |
|||
create table t1 (g geometry not null, spatial gk(g)) engine=innodb; |
|||
ERROR HY000: The used table type doesn't support SPATIAL indexes |
|||
@ -0,0 +1,375 @@ |
|||
# |
|||
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout |
|||
# without error |
|||
# |
|||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB; |
|||
INSERT INTO t1 (a,b) VALUES (1070109,99); |
|||
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB; |
|||
INSERT INTO t2 (b,a) VALUES (7,1070109); |
|||
SELECT * FROM t1; |
|||
a b |
|||
1070109 99 |
|||
BEGIN; |
|||
SELECT b FROM t2 WHERE b=7 FOR UPDATE; |
|||
b |
|||
7 |
|||
BEGIN; |
|||
SELECT b FROM t2 WHERE b=7 FOR UPDATE; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7)); |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7); |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7); |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
SELECT * FROM t1; |
|||
a b |
|||
1070109 99 |
|||
DROP TABLE t2, t1; |
|||
# End of 5.0 tests |
|||
# |
|||
# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT |
|||
# FOR UPDATE |
|||
# |
|||
drop table if exists t1; |
|||
create table t1 (a int primary key auto_increment, |
|||
b int, index(b)) engine=innodb; |
|||
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); |
|||
set autocommit=0; |
|||
begin; |
|||
select * from t1 where b=5 for update; |
|||
a b |
|||
5 5 |
|||
insert ignore into t1 (b) select a as b from t1; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
# Cleanup |
|||
# |
|||
commit; |
|||
set autocommit=default; |
|||
drop table t1; |
|||
# |
|||
# Bug #37183 insert ignore into .. select ... hangs |
|||
# after deadlock was encountered |
|||
# |
|||
create table t1(id int primary key,v int)engine=innodb; |
|||
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); |
|||
create table t2 like t1; |
|||
begin; |
|||
update t1 set v=id*2 where id=1; |
|||
begin; |
|||
update t1 set v=id*2 where id=2; |
|||
update t1 set v=id*2 where id=2; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
insert ignore into t2 select * from t1 where id=1; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
rollback; |
|||
rollback; |
|||
drop table t1, t2; |
|||
# |
|||
# Bug#41756 Strange error messages about locks from InnoDB |
|||
# |
|||
drop table if exists t1; |
|||
# In the default transaction isolation mode, and/or with |
|||
# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row() |
|||
# in InnoDB does nothing. |
|||
# Thus in order to reproduce the condition that led to the |
|||
# warning, one needs to relax isolation by either |
|||
# setting a weaker tx_isolation value, or by turning on |
|||
# the unsafe replication switch. |
|||
# For testing purposes, choose to tweak the isolation level, |
|||
# since it's settable at runtime, unlike |
|||
# innodb_locks_unsafe_for_binlog, which is |
|||
# only a command-line switch. |
|||
# |
|||
set @@session.tx_isolation="read-committed"; |
|||
# Prepare data. We need a table with a unique index, |
|||
# for join_read_key to be used. The other column |
|||
# allows to control what passes WHERE clause filter. |
|||
create table t1 (a int primary key, b int) engine=innodb; |
|||
# Let's make sure t1 has sufficient amount of rows |
|||
# to exclude JT_ALL access method when reading it, |
|||
# i.e. make sure that JT_EQ_REF(a) is always preferred. |
|||
insert into t1 values (1,1), (2,null), (3,1), (4,1), |
|||
(5,1), (6,1), (7,1), (8,1), (9,1), (10,1), |
|||
(11,1), (12,1), (13,1), (14,1), (15,1), |
|||
(16,1), (17,1), (18,1), (19,1), (20,1); |
|||
# |
|||
# Demonstrate that for the SELECT statement |
|||
# used later in the test JT_EQ_REF access method is used. |
|||
# |
|||
explain |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
id 1 |
|||
select_type PRIMARY |
|||
table <derived2> |
|||
type ALL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows 2 |
|||
Extra |
|||
id 1 |
|||
select_type PRIMARY |
|||
table t1 |
|||
type eq_ref |
|||
possible_keys PRIMARY |
|||
key PRIMARY |
|||
key_len 4 |
|||
ref t2.a |
|||
rows 1 |
|||
Extra Using where |
|||
id 2 |
|||
select_type DERIVED |
|||
table NULL |
|||
type NULL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra No tables used |
|||
id 3 |
|||
select_type UNION |
|||
table NULL |
|||
type NULL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra No tables used |
|||
id NULL |
|||
select_type UNION RESULT |
|||
table <union2,3> |
|||
type ALL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra |
|||
# |
|||
# Demonstrate that the reported SELECT statement |
|||
# no longer produces warnings. |
|||
# |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
1 |
|||
commit; |
|||
# |
|||
# Demonstrate that due to lack of inter-sweep "reset" function, |
|||
# we keep some non-matching records locked, even though we know |
|||
# we could unlock them. |
|||
# To do that, show that if there is only one distinct value |
|||
# for a in t2 (a=2), we will keep record (2,null) in t1 locked. |
|||
# But if we add another value for "a" to t2, say 6, |
|||
# join_read_key cache will be pruned at least once, |
|||
# and thus record (2, null) in t1 will get unlocked. |
|||
# |
|||
begin; |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
1 |
|||
# |
|||
# Switching to connection con1 |
|||
# We should be able to delete all records from t1 except (2, null), |
|||
# since they were not locked. |
|||
begin; |
|||
# Delete in series of 3 records so that full scan |
|||
# is not used and we're not blocked on record (2,null) |
|||
delete from t1 where a in (1,3,4); |
|||
delete from t1 where a in (5,6,7); |
|||
delete from t1 where a in (8,9,10); |
|||
delete from t1 where a in (11,12,13); |
|||
delete from t1 where a in (14,15,16); |
|||
delete from t1 where a in (17,18); |
|||
delete from t1 where a in (19,20); |
|||
# |
|||
# Record (2, null) is locked. This is actually unnecessary, |
|||
# because the previous select returned no rows. |
|||
# Just demonstrate the effect. |
|||
# |
|||
delete from t1; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
rollback; |
|||
# |
|||
# Switching to connection default |
|||
# |
|||
# Show that the original contents of t1 is intact: |
|||
select * from t1; |
|||
a b |
|||
1 1 |
|||
2 NULL |
|||
3 1 |
|||
4 1 |
|||
5 1 |
|||
6 1 |
|||
7 1 |
|||
8 1 |
|||
9 1 |
|||
10 1 |
|||
11 1 |
|||
12 1 |
|||
13 1 |
|||
14 1 |
|||
15 1 |
|||
16 1 |
|||
17 1 |
|||
18 1 |
|||
19 1 |
|||
20 1 |
|||
commit; |
|||
# |
|||
# Have a one more record in t2 to show that |
|||
# if join_read_key cache is purned, the current |
|||
# row under the cursor is unlocked (provided, this row didn't |
|||
# match the partial WHERE clause, of course). |
|||
# Sic: the result of this test dependent on the order of retrieval |
|||
# of records --echo # from the derived table, if ! |
|||
# We use DELETE to disable the JOIN CACHE. This DELETE modifies no |
|||
# records. It also should leave no InnoDB row locks. |
|||
# |
|||
begin; |
|||
delete t1.* from t1 natural join (select 2 as a, 2 as b union all |
|||
select 0 as a, 0 as b) as t2; |
|||
# Demonstrate that nothing was deleted form t1 |
|||
select * from t1; |
|||
a b |
|||
1 1 |
|||
2 NULL |
|||
3 1 |
|||
4 1 |
|||
5 1 |
|||
6 1 |
|||
7 1 |
|||
8 1 |
|||
9 1 |
|||
10 1 |
|||
11 1 |
|||
12 1 |
|||
13 1 |
|||
14 1 |
|||
15 1 |
|||
16 1 |
|||
17 1 |
|||
18 1 |
|||
19 1 |
|||
20 1 |
|||
# |
|||
# Switching to connection con1 |
|||
begin; |
|||
# Since there is another distinct record in the derived table |
|||
# the previous matching record in t1 -- (2,null) -- was unlocked. |
|||
delete from t1; |
|||
# We will need the contents of the table again. |
|||
rollback; |
|||
select * from t1; |
|||
a b |
|||
1 1 |
|||
2 NULL |
|||
3 1 |
|||
4 1 |
|||
5 1 |
|||
6 1 |
|||
7 1 |
|||
8 1 |
|||
9 1 |
|||
10 1 |
|||
11 1 |
|||
12 1 |
|||
13 1 |
|||
14 1 |
|||
15 1 |
|||
16 1 |
|||
17 1 |
|||
18 1 |
|||
19 1 |
|||
20 1 |
|||
commit; |
|||
# |
|||
# Switching to connection default |
|||
rollback; |
|||
begin; |
|||
# |
|||
# Before this patch, we could wrongly unlock a record |
|||
# that was cached and later used in a join. Demonstrate that |
|||
# this is no longer the case. |
|||
# Sic: this test is also order-dependent (i.e. the |
|||
# the bug would show up only if the first record in the union |
|||
# is retreived and processed first. |
|||
# |
|||
# Verify that JT_EQ_REF is used. |
|||
explain |
|||
select 1 from t1 natural join (select 3 as a, 2 as b union all |
|||
select 3 as a, 1 as b) as t2 for update; |
|||
id 1 |
|||
select_type PRIMARY |
|||
table <derived2> |
|||
type ALL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows 2 |
|||
Extra |
|||
id 1 |
|||
select_type PRIMARY |
|||
table t1 |
|||
type eq_ref |
|||
possible_keys PRIMARY |
|||
key PRIMARY |
|||
key_len 4 |
|||
ref t2.a |
|||
rows 1 |
|||
Extra Using where |
|||
id 2 |
|||
select_type DERIVED |
|||
table NULL |
|||
type NULL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra No tables used |
|||
id 3 |
|||
select_type UNION |
|||
table NULL |
|||
type NULL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra No tables used |
|||
id NULL |
|||
select_type UNION RESULT |
|||
table <union2,3> |
|||
type ALL |
|||
possible_keys NULL |
|||
key NULL |
|||
key_len NULL |
|||
ref NULL |
|||
rows NULL |
|||
Extra |
|||
# Lock the record. |
|||
select 1 from t1 natural join (select 3 as a, 2 as b union all |
|||
select 3 as a, 1 as b) as t2 for update; |
|||
1 |
|||
1 |
|||
# Switching to connection con1 |
|||
# |
|||
# We should not be able to delete record (3,1) from t1, |
|||
# (previously it was possible). |
|||
# |
|||
delete from t1 where a=3; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
# Switching to connection default |
|||
commit; |
|||
set @@session.tx_isolation=default; |
|||
drop table t1; |
|||
# |
|||
# End of 5.1 tests |
|||
# |
|||
2393
mysql-test/suite/innodb_plugin/r/innodb_mysql.result
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,21 @@ |
|||
CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb |
|||
DEFAULT CHARSET=latin1; |
|||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); |
|||
START TRANSACTION; |
|||
SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; |
|||
a b |
|||
3 3 |
|||
START TRANSACTION; |
|||
UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
ROLLBACK; |
|||
START TRANSACTION; |
|||
SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; |
|||
a b |
|||
3 3 |
|||
START TRANSACTION; |
|||
UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
SELECT * FROM t1 WHERE b = 10; |
|||
a b |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,23 @@ |
|||
drop table if exists t1; |
|||
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; |
|||
SET GLOBAL log_bin_trust_function_creators = 1; |
|||
create table t1 (col1 integer primary key, col2 integer) engine=innodb; |
|||
insert t1 values (1,100); |
|||
create function f1 () returns integer begin |
|||
declare var1 int; |
|||
select col2 into var1 from t1 where col1=1 for update; |
|||
return var1; |
|||
end| |
|||
start transaction; |
|||
select f1(); |
|||
f1() |
|||
100 |
|||
update t1 set col2=0 where col1=1; |
|||
select * from t1; |
|||
col1 col2 |
|||
1 100 |
|||
rollback; |
|||
rollback; |
|||
drop table t1; |
|||
drop function f1; |
|||
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; |
|||
@ -0,0 +1,36 @@ |
|||
drop table if exists t1; |
|||
show variables like 'innodb_rollback_on_timeout'; |
|||
Variable_name Value |
|||
innodb_rollback_on_timeout ON |
|||
create table t1 (a int unsigned not null primary key) engine = innodb; |
|||
insert into t1 values (1); |
|||
commit; |
|||
begin work; |
|||
insert into t1 values (2); |
|||
select * from t1; |
|||
a |
|||
1 |
|||
2 |
|||
begin work; |
|||
insert into t1 values (5); |
|||
select * from t1; |
|||
a |
|||
1 |
|||
5 |
|||
insert into t1 values (2); |
|||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
|||
select * from t1; |
|||
a |
|||
1 |
|||
commit; |
|||
select * from t1; |
|||
a |
|||
1 |
|||
2 |
|||
commit; |
|||
select * from t1; |
|||
a |
|||
1 |
|||
2 |
|||
drop table t1; |
|||
End of 5.0 tests |
|||
@ -0,0 +1,19 @@ |
|||
-- source include/have_innodb_plugin.inc |
|||
# embedded server ignores 'delayed', so skip this |
|||
-- source include/not_embedded.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
|
|||
# |
|||
# Bug 34286 |
|||
# |
|||
create table t1(a int not null auto_increment primary key) engine=innodb; |
|||
insert into t1 set a = -1; |
|||
# NOTE: The database needs to be shutdown and restarted (here) for |
|||
# the test to work. It's included for reference only. |
|||
optimize table t1; |
|||
|
|||
--echo ==== clean up ==== |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,230 @@ |
|||
-- source include/have_innodb_plugin.inc |
|||
-- source include/have_ucs2.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1, t2; |
|||
--enable_warnings |
|||
|
|||
# |
|||
# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record.. |
|||
# |
|||
|
|||
create table t1 ( |
|||
a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
drop table t1; |
|||
drop table t2; |
|||
|
|||
create table t1 ( |
|||
a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
drop table t1; |
|||
drop table t2; |
|||
|
|||
create table t1 ( |
|||
a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six'); |
|||
insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven'); |
|||
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
drop table t1; |
|||
drop table t2; |
|||
|
|||
create table t1 ( |
|||
a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set utf8 engine = innodb; |
|||
create table t2 ( |
|||
a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2)) |
|||
) character set ucs2 engine = innodb; |
|||
insert into t1 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t1 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t1 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four'); |
|||
insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five'); |
|||
insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight'); |
|||
insert into t2 values (1,'abcdefg','abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','ijkilmn','two'); |
|||
insert into t2 values (3,'qrstuvw','qrstuvw','three'); |
|||
insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four'); |
|||
insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five'); |
|||
insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six'); |
|||
insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven'); |
|||
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight'); |
|||
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten'); |
|||
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); |
|||
update t1 set filler = 'boo' where a = 1; |
|||
update t2 set filler ='email' where a = 4; |
|||
select a,hex(b),hex(c),filler from t1 order by filler; |
|||
select a,hex(b),hex(c),filler from t2 order by filler; |
|||
drop table t1; |
|||
drop table t2; |
|||
commit; |
|||
|
|||
# |
|||
# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key |
|||
# |
|||
CREATE TABLE t1 ( |
|||
ind enum('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind enum('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
|
|||
INSERT INTO t1 VALUES ('1', ''),('2', ''); |
|||
INSERT INTO t2 VALUES ('1', ''),('2', ''); |
|||
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; |
|||
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; |
|||
drop table t1,t2; |
|||
|
|||
CREATE TABLE t1 ( |
|||
ind set('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind set('0','1','2') NOT NULL default '0', |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
|
|||
INSERT INTO t1 VALUES ('1', ''),('2', ''); |
|||
INSERT INTO t2 VALUES ('1', ''),('2', ''); |
|||
SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1; |
|||
SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1; |
|||
drop table t1,t2; |
|||
|
|||
CREATE TABLE t1 ( |
|||
ind bit not null, |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|||
CREATE TABLE t2 ( |
|||
ind bit not null, |
|||
string1 varchar(250) NOT NULL, |
|||
PRIMARY KEY (ind) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=ucs2; |
|||
insert into t1 values(0,''),(1,''); |
|||
insert into t2 values(0,''),(1,''); |
|||
select hex(ind),hex(string1) from t1 order by string1; |
|||
select hex(ind),hex(string1) from t2 order by string1; |
|||
drop table t1,t2; |
|||
|
|||
# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..' |
|||
|
|||
create table t2 ( |
|||
a int, b char(10), filler char(10), primary key(a, b(2)) |
|||
) character set utf8 engine = innodb; |
|||
|
|||
insert into t2 values (1,'abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','two'); |
|||
insert into t2 values (3, 'qrstuvw','three'); |
|||
update t2 set a=5, filler='booo' where a=1; |
|||
drop table t2; |
|||
create table t2 ( |
|||
a int, b char(10), filler char(10), primary key(a, b(2)) |
|||
) character set ucs2 engine = innodb; |
|||
|
|||
insert into t2 values (1,'abcdefg','one'); |
|||
insert into t2 values (2,'ijkilmn','two'); |
|||
insert into t2 values (3, 'qrstuvw','three'); |
|||
update t2 set a=5, filler='booo' where a=1; |
|||
drop table t2; |
|||
|
|||
create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8; |
|||
insert into t1 values(1,'abcdefg'),(2,'defghijk'); |
|||
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); |
|||
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); |
|||
select a,hex(b) from t1 order by b; |
|||
update t1 set b = 'three' where a = 6; |
|||
drop table t1; |
|||
create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8; |
|||
insert into t1 values(1,'abcdefg'),(2,'defghijk'); |
|||
insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1); |
|||
insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2); |
|||
select a,hex(b) from t1 order by b; |
|||
update t1 set b = 'three' where a = 6; |
|||
drop table t1; |
|||
|
|||
--echo End of 5.0 tests |
|||
@ -0,0 +1 @@ |
|||
--innodb-autoinc-lock-mode=0 |
|||
@ -0,0 +1,44 @@ |
|||
# This test runs with old-style locking, as: |
|||
# --innodb-autoinc-lock-mode=0 |
|||
|
|||
-- source include/have_innodb_plugin.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
|
|||
|
|||
# |
|||
# Search on unique key |
|||
# |
|||
|
|||
CREATE TABLE t1 ( |
|||
id int(11) NOT NULL auto_increment, |
|||
ggid varchar(32) binary DEFAULT '' NOT NULL, |
|||
email varchar(64) DEFAULT '' NOT NULL, |
|||
passwd varchar(32) binary DEFAULT '' NOT NULL, |
|||
PRIMARY KEY (id), |
|||
UNIQUE ggid (ggid) |
|||
) ENGINE=innodb; |
|||
|
|||
insert into t1 (ggid,passwd) values ('test1','xxx'); |
|||
insert into t1 (ggid,passwd) values ('test2','yyy'); |
|||
-- error ER_DUP_ENTRY |
|||
insert into t1 (ggid,passwd) values ('test2','this will fail'); |
|||
-- error ER_DUP_ENTRY |
|||
insert into t1 (ggid,id) values ('this will fail',1); |
|||
|
|||
select * from t1 where ggid='test1'; |
|||
select * from t1 where passwd='xxx'; |
|||
select * from t1 where id=2; |
|||
|
|||
replace into t1 (ggid,id) values ('this will work',1); |
|||
replace into t1 (ggid,passwd) values ('test2','this will work'); |
|||
-- error ER_DUP_ENTRY |
|||
update t1 set id=100,ggid='test2' where id=1; |
|||
select * from t1; |
|||
select * from t1 where id=1; |
|||
select * from t1 where id=999; |
|||
drop table t1; |
|||
|
|||
--echo End of tests |
|||
@ -0,0 +1 @@ |
|||
--innodb --innodb_autoinc_lock_mode=0 |
|||
@ -0,0 +1,68 @@ |
|||
--source include/have_innodb_plugin.inc |
|||
--source include/have_partition.inc |
|||
--vertical_results |
|||
let $engine_type= 'innodb'; |
|||
|
|||
######## Creat Table Section ######### |
|||
use test; |
|||
|
|||
eval CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, |
|||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, |
|||
fkid MEDIUMINT, filler VARCHAR(255), |
|||
PRIMARY KEY(id)) ENGINE=$engine_type |
|||
PARTITION BY RANGE(id) |
|||
SUBPARTITION BY hash(id) subpartitions 2 |
|||
(PARTITION pa3 values less than (42), |
|||
PARTITION pa6 values less than (60), |
|||
PARTITION pa7 values less than (70), |
|||
PARTITION pa8 values less than (80), |
|||
PARTITION pa9 values less than (90), |
|||
PARTITION pa10 values less than (100), |
|||
PARTITION pa11 values less than MAXVALUE); |
|||
|
|||
######## Create SPs, Functions, Views and Triggers Section ############## |
|||
|
|||
delimiter |; |
|||
|
|||
CREATE PROCEDURE test.proc_part() |
|||
BEGIN |
|||
DECLARE ins_count INT DEFAULT 1000; |
|||
DECLARE del_count INT; |
|||
DECLARE cur_user VARCHAR(255); |
|||
DECLARE local_uuid VARCHAR(255); |
|||
DECLARE local_time TIMESTAMP; |
|||
|
|||
SET local_time= NOW(); |
|||
SET cur_user= CURRENT_USER(); |
|||
SET local_uuid= UUID(); |
|||
|
|||
WHILE ins_count > 0 DO |
|||
INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(), |
|||
ins_count,'Going to test MBR for MySQL'); |
|||
SET ins_count = ins_count - 1; |
|||
END WHILE; |
|||
SELECT MAX(id) FROM test.part_tbl INTO del_count; |
|||
WHILE del_count > 0 DO |
|||
DELETE FROM test.part_tbl WHERE id = del_count; |
|||
select count(*) as internal_count, del_count -- these two lines are for |
|||
FROM test.part_tbl; -- debug to show the problem |
|||
SET del_count = del_count - 2; |
|||
END WHILE; |
|||
END| |
|||
|
|||
delimiter ;| |
|||
|
|||
############ Finish Setup Section ################### |
|||
|
|||
############ Test Section ################### |
|||
--horizontal_results |
|||
|
|||
CALL test.proc_part(); |
|||
|
|||
select count(*) as Part from test.part_tbl; |
|||
|
|||
###### CLEAN UP SECTION ############## |
|||
|
|||
DROP PROCEDURE test.proc_part; |
|||
DROP TABLE test.part_tbl; |
|||
|
|||
@ -0,0 +1,78 @@ |
|||
# |
|||
# Testcase for InnoDB |
|||
# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections |
|||
# |
|||
|
|||
--source include/not_embedded.inc |
|||
--source include/have_innodb_plugin.inc |
|||
|
|||
let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1); |
|||
if (`SELECT $innodb_lock_wait_timeout < 10`) |
|||
{ |
|||
--echo # innodb_lock_wait_timeout must be >= 10 seconds |
|||
--echo # so that this test can work all time fine on an overloaded testing box |
|||
SHOW VARIABLES LIKE 'innodb_lock_wait_timeout'; |
|||
exit; |
|||
} |
|||
|
|||
# Save the initial number of concurrent sessions |
|||
--source include/count_sessions.inc |
|||
|
|||
# First session |
|||
connection default; |
|||
|
|||
|
|||
--enable_warnings |
|||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB; |
|||
|
|||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3); |
|||
COMMIT; |
|||
SET AUTOCOMMIT = 0; |
|||
|
|||
CREATE TEMPORARY TABLE t1_tmp ( b INT ); |
|||
|
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3; |
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2; |
|||
|
|||
# Second session |
|||
connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK); |
|||
|
|||
SET AUTOCOMMIT = 0; |
|||
|
|||
CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int ); |
|||
INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53); |
|||
|
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1; |
|||
send |
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2; |
|||
|
|||
# The last update will wait for a lock held by the first session |
|||
|
|||
# First session |
|||
connection default; |
|||
|
|||
# Poll till the UPDATE of the second session waits for lock |
|||
let $show_statement= SHOW PROCESSLIST; |
|||
let $field= State; |
|||
let $condition= = 'Updating'; |
|||
--source include/wait_show_condition.inc |
|||
|
|||
# If the testing box is overloadeded and innodb_lock_wait_timeout is too small |
|||
# we might get here ER_LOCK_WAIT_TIMEOUT. |
|||
--error ER_LOCK_DEADLOCK |
|||
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1; |
|||
|
|||
# Second session |
|||
connection user2; |
|||
--echo Reap the server message for connection user2 UPDATE t1 ... |
|||
reap; |
|||
|
|||
# The server crashed when executing this UPDATE or the succeeding SQL command. |
|||
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3; |
|||
|
|||
connection default; |
|||
disconnect user2; |
|||
DROP TABLE t1; |
|||
|
|||
# Wait till all disconnects are completed |
|||
--source include/wait_until_count_sessions.inc |
|||
@ -0,0 +1 @@ |
|||
--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed |
|||
@ -0,0 +1,8 @@ |
|||
-- source include/have_innodb_plugin.inc |
|||
|
|||
create table bug53674(a int)engine=innodb; |
|||
insert into bug53674 values (1),(2); |
|||
start transaction; |
|||
select * from bug53674 for update; |
|||
select * from bug53674 where a=(select a from bug53674 where a > 1); |
|||
drop table bug53674; |
|||
@ -0,0 +1,11 @@ |
|||
# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type |
|||
# during create table, so it will not trigger assertion failure. |
|||
|
|||
--source include/have_innodb_plugin.inc |
|||
|
|||
# This 'create table' operation should fail because of |
|||
# using NULL datatype |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB |
|||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL); |
|||
|
|||
@ -0,0 +1,97 @@ |
|||
# Test Bug #54679 alter table causes compressed row_format to revert to compact |
|||
|
|||
--source include/have_innodb_plugin.inc |
|||
|
|||
let $file_format=`select @@innodb_file_format`; |
|||
let $file_format_check=`select @@innodb_file_format_check`; |
|||
let $file_per_table=`select @@innodb_file_per_table`; |
|||
SET GLOBAL innodb_file_format='Barracuda'; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
SET innodb_strict_mode=ON; |
|||
|
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# The ROW_FORMAT of the table should be preserved when it is not specified |
|||
# in ALTER TABLE. |
|||
ALTER TABLE bug54679 ADD COLUMN b INT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
DROP TABLE bug54679; |
|||
|
|||
# Check that the ROW_FORMAT conversion to/from COMPRESSED works. |
|||
|
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# KEY_BLOCK_SIZE implies COMPRESSED. |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables. |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
|
|||
SET GLOBAL innodb_file_format=Barracuda; |
|||
# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace |
|||
# cannot be compressed. |
|||
SET GLOBAL innodb_file_per_table=OFF; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
DROP TABLE bug54679; |
|||
|
|||
EVAL SET GLOBAL innodb_file_format=$file_format; |
|||
EVAL SET GLOBAL innodb_file_format_check=$file_format_check; |
|||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table; |
|||
@ -0,0 +1,10 @@ |
|||
--source include/have_innodb_plugin.inc |
|||
SET storage_engine=innodb; |
|||
--source include/gis_generic.inc |
|||
--source include/gis_keys.inc |
|||
|
|||
# |
|||
# Bug #15680 (SPATIAL key in innodb) |
|||
# |
|||
--error ER_TABLE_CANT_HANDLE_SPKEYS |
|||
create table t1 (g geometry not null, spatial gk(g)) engine=innodb; |
|||
@ -0,0 +1 @@ |
|||
--innodb_lock_wait_timeout=1 |
|||
@ -0,0 +1,264 @@ |
|||
--source include/have_innodb_plugin.inc |
|||
|
|||
--echo # |
|||
--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout |
|||
--echo # without error |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB; |
|||
|
|||
INSERT INTO t1 (a,b) VALUES (1070109,99); |
|||
|
|||
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB; |
|||
|
|||
INSERT INTO t2 (b,a) VALUES (7,1070109); |
|||
|
|||
SELECT * FROM t1; |
|||
|
|||
BEGIN; |
|||
|
|||
SELECT b FROM t2 WHERE b=7 FOR UPDATE; |
|||
|
|||
CONNECT (addconroot, localhost, root,,); |
|||
CONNECTION addconroot; |
|||
|
|||
BEGIN; |
|||
|
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
SELECT b FROM t2 WHERE b=7 FOR UPDATE; |
|||
|
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7)); |
|||
|
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7); |
|||
|
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7); |
|||
|
|||
SELECT * FROM t1; |
|||
|
|||
CONNECTION default; |
|||
DISCONNECT addconroot; |
|||
|
|||
DROP TABLE t2, t1; |
|||
|
|||
--echo # End of 5.0 tests |
|||
|
|||
--echo # |
|||
--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT |
|||
--echo # FOR UPDATE |
|||
--echo # |
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
create table t1 (a int primary key auto_increment, |
|||
b int, index(b)) engine=innodb; |
|||
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); |
|||
set autocommit=0; |
|||
begin; |
|||
select * from t1 where b=5 for update; |
|||
connect (con1, localhost, root,,); |
|||
connection con1; |
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
insert ignore into t1 (b) select a as b from t1; |
|||
connection default; |
|||
--echo # Cleanup |
|||
--echo # |
|||
disconnect con1; |
|||
commit; |
|||
set autocommit=default; |
|||
drop table t1; |
|||
|
|||
--echo # |
|||
--echo # Bug #37183 insert ignore into .. select ... hangs |
|||
--echo # after deadlock was encountered |
|||
--echo # |
|||
connect (con1,localhost,root,,); |
|||
create table t1(id int primary key,v int)engine=innodb; |
|||
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); |
|||
create table t2 like t1; |
|||
|
|||
--connection con1 |
|||
begin; |
|||
update t1 set v=id*2 where id=1; |
|||
|
|||
--connection default |
|||
begin; |
|||
update t1 set v=id*2 where id=2; |
|||
|
|||
--connection con1 |
|||
--error 1205 |
|||
update t1 set v=id*2 where id=2; |
|||
|
|||
--connection default |
|||
--error 1205 |
|||
insert ignore into t2 select * from t1 where id=1; |
|||
rollback; |
|||
|
|||
--connection con1 |
|||
rollback; |
|||
|
|||
--connection default |
|||
disconnect con1; |
|||
drop table t1, t2; |
|||
|
|||
|
|||
--echo # |
|||
--echo # Bug#41756 Strange error messages about locks from InnoDB |
|||
--echo # |
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
--echo # In the default transaction isolation mode, and/or with |
|||
--echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row() |
|||
--echo # in InnoDB does nothing. |
|||
--echo # Thus in order to reproduce the condition that led to the |
|||
--echo # warning, one needs to relax isolation by either |
|||
--echo # setting a weaker tx_isolation value, or by turning on |
|||
--echo # the unsafe replication switch. |
|||
--echo # For testing purposes, choose to tweak the isolation level, |
|||
--echo # since it's settable at runtime, unlike |
|||
--echo # innodb_locks_unsafe_for_binlog, which is |
|||
--echo # only a command-line switch. |
|||
--echo # |
|||
set @@session.tx_isolation="read-committed"; |
|||
|
|||
--echo # Prepare data. We need a table with a unique index, |
|||
--echo # for join_read_key to be used. The other column |
|||
--echo # allows to control what passes WHERE clause filter. |
|||
create table t1 (a int primary key, b int) engine=innodb; |
|||
--echo # Let's make sure t1 has sufficient amount of rows |
|||
--echo # to exclude JT_ALL access method when reading it, |
|||
--echo # i.e. make sure that JT_EQ_REF(a) is always preferred. |
|||
insert into t1 values (1,1), (2,null), (3,1), (4,1), |
|||
(5,1), (6,1), (7,1), (8,1), (9,1), (10,1), |
|||
(11,1), (12,1), (13,1), (14,1), (15,1), |
|||
(16,1), (17,1), (18,1), (19,1), (20,1); |
|||
--echo # |
|||
--echo # Demonstrate that for the SELECT statement |
|||
--echo # used later in the test JT_EQ_REF access method is used. |
|||
--echo # |
|||
--vertical_results |
|||
explain |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
--horizontal_results |
|||
--echo # |
|||
--echo # Demonstrate that the reported SELECT statement |
|||
--echo # no longer produces warnings. |
|||
--echo # |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
commit; |
|||
--echo # |
|||
--echo # Demonstrate that due to lack of inter-sweep "reset" function, |
|||
--echo # we keep some non-matching records locked, even though we know |
|||
--echo # we could unlock them. |
|||
--echo # To do that, show that if there is only one distinct value |
|||
--echo # for a in t2 (a=2), we will keep record (2,null) in t1 locked. |
|||
--echo # But if we add another value for "a" to t2, say 6, |
|||
--echo # join_read_key cache will be pruned at least once, |
|||
--echo # and thus record (2, null) in t1 will get unlocked. |
|||
--echo # |
|||
begin; |
|||
select 1 from t1 natural join (select 2 as a, 1 as b union all |
|||
select 2 as a, 2 as b) as t2 for update; |
|||
connect (con1,localhost,root,,); |
|||
--echo # |
|||
--echo # Switching to connection con1 |
|||
connection con1; |
|||
--echo # We should be able to delete all records from t1 except (2, null), |
|||
--echo # since they were not locked. |
|||
begin; |
|||
--echo # Delete in series of 3 records so that full scan |
|||
--echo # is not used and we're not blocked on record (2,null) |
|||
delete from t1 where a in (1,3,4); |
|||
delete from t1 where a in (5,6,7); |
|||
delete from t1 where a in (8,9,10); |
|||
delete from t1 where a in (11,12,13); |
|||
delete from t1 where a in (14,15,16); |
|||
delete from t1 where a in (17,18); |
|||
delete from t1 where a in (19,20); |
|||
--echo # |
|||
--echo # Record (2, null) is locked. This is actually unnecessary, |
|||
--echo # because the previous select returned no rows. |
|||
--echo # Just demonstrate the effect. |
|||
--echo # |
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
delete from t1; |
|||
rollback; |
|||
--echo # |
|||
--echo # Switching to connection default |
|||
connection default; |
|||
--echo # |
|||
--echo # Show that the original contents of t1 is intact: |
|||
select * from t1; |
|||
commit; |
|||
--echo # |
|||
--echo # Have a one more record in t2 to show that |
|||
--echo # if join_read_key cache is purned, the current |
|||
--echo # row under the cursor is unlocked (provided, this row didn't |
|||
--echo # match the partial WHERE clause, of course). |
|||
--echo # Sic: the result of this test dependent on the order of retrieval |
|||
--echo # of records --echo # from the derived table, if ! |
|||
--echo # We use DELETE to disable the JOIN CACHE. This DELETE modifies no |
|||
--echo # records. It also should leave no InnoDB row locks. |
|||
--echo # |
|||
begin; |
|||
delete t1.* from t1 natural join (select 2 as a, 2 as b union all |
|||
select 0 as a, 0 as b) as t2; |
|||
--echo # Demonstrate that nothing was deleted form t1 |
|||
select * from t1; |
|||
--echo # |
|||
--echo # Switching to connection con1 |
|||
connection con1; |
|||
begin; |
|||
--echo # Since there is another distinct record in the derived table |
|||
--echo # the previous matching record in t1 -- (2,null) -- was unlocked. |
|||
delete from t1; |
|||
--echo # We will need the contents of the table again. |
|||
rollback; |
|||
select * from t1; |
|||
commit; |
|||
--echo # |
|||
--echo # Switching to connection default |
|||
connection default; |
|||
rollback; |
|||
begin; |
|||
--echo # |
|||
--echo # Before this patch, we could wrongly unlock a record |
|||
--echo # that was cached and later used in a join. Demonstrate that |
|||
--echo # this is no longer the case. |
|||
--echo # Sic: this test is also order-dependent (i.e. the |
|||
--echo # the bug would show up only if the first record in the union |
|||
--echo # is retreived and processed first. |
|||
--echo # |
|||
--echo # Verify that JT_EQ_REF is used. |
|||
--vertical_results |
|||
explain |
|||
select 1 from t1 natural join (select 3 as a, 2 as b union all |
|||
select 3 as a, 1 as b) as t2 for update; |
|||
--horizontal_results |
|||
--echo # Lock the record. |
|||
select 1 from t1 natural join (select 3 as a, 2 as b union all |
|||
select 3 as a, 1 as b) as t2 for update; |
|||
--echo # Switching to connection con1 |
|||
connection con1; |
|||
--echo # |
|||
--echo # We should not be able to delete record (3,1) from t1, |
|||
--echo # (previously it was possible). |
|||
--echo # |
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
delete from t1 where a=3; |
|||
--echo # Switching to connection default |
|||
connection default; |
|||
commit; |
|||
|
|||
disconnect con1; |
|||
set @@session.tx_isolation=default; |
|||
drop table t1; |
|||
|
|||
--echo # |
|||
--echo # End of 5.1 tests |
|||
--echo # |
|||
@ -0,0 +1 @@ |
|||
--innodb-lock-wait-timeout=2 |
|||
@ -0,0 +1,635 @@ |
|||
# t/innodb_mysql.test |
|||
# |
|||
# Last update: |
|||
# 2006-07-26 ML test refactored (MySQL 5.1) |
|||
# main testing code t/innodb_mysql.test -> include/mix1.inc |
|||
# |
|||
|
|||
-- source include/have_innodb_plugin.inc |
|||
let $engine_type= InnoDB; |
|||
let $other_engine_type= MEMORY; |
|||
# InnoDB does support FOREIGN KEYFOREIGN KEYs |
|||
let $test_foreign_keys= 1; |
|||
set global innodb_support_xa=default; |
|||
set session innodb_support_xa=default; |
|||
--source include/mix1.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1, t2, t3; |
|||
--enable_warnings |
|||
# |
|||
# BUG#35850: Performance regression in 5.1.23/5.1.24 |
|||
# |
|||
create table t1(a int); |
|||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); |
|||
create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb; |
|||
insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C; |
|||
--echo this must use key 'a', not PRIMARY: |
|||
--replace_column 9 # |
|||
explain select a from t2 where a=b; |
|||
drop table t1, t2; |
|||
|
|||
# |
|||
# Bug #40360: Binlog related errors with binlog off |
|||
# |
|||
# This bug is triggered when the binlog format is STATEMENT and the |
|||
# binary log is turned off. In this case, no error should be shown for |
|||
# the statement since there are no replication issues. |
|||
|
|||
SET SESSION BINLOG_FORMAT=STATEMENT; |
|||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; |
|||
query_vertical select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation; |
|||
CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; |
|||
INSERT INTO t1 VALUES(1); |
|||
DROP TABLE t1; |
|||
|
|||
# |
|||
# Bug#37284 Crash in Field_string::type() |
|||
# |
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1; |
|||
--enable_warnings |
|||
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB; |
|||
CREATE INDEX i1 on t1 (a(3)); |
|||
SELECT * FROM t1 WHERE a = 'abcde'; |
|||
DROP TABLE t1; |
|||
|
|||
# |
|||
# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of |
|||
# requested column |
|||
# |
|||
|
|||
CREATE TABLE foo (a int, b int, c char(10), |
|||
PRIMARY KEY (c(3)), |
|||
KEY b (b) |
|||
) engine=innodb; |
|||
|
|||
CREATE TABLE foo2 (a int, b int, c char(10), |
|||
PRIMARY KEY (c), |
|||
KEY b (b) |
|||
) engine=innodb; |
|||
|
|||
CREATE TABLE bar (a int, b int, c char(10), |
|||
PRIMARY KEY (c(3)), |
|||
KEY b (b) |
|||
) engine=myisam; |
|||
|
|||
INSERT INTO foo VALUES |
|||
(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), |
|||
(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); |
|||
|
|||
INSERT INTO bar SELECT * FROM foo; |
|||
INSERT INTO foo2 SELECT * FROM foo; |
|||
|
|||
--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2; |
|||
--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2; |
|||
--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2; |
|||
|
|||
--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2; |
|||
--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2; |
|||
--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2; |
|||
|
|||
DROP TABLE foo, bar, foo2; |
|||
|
|||
|
|||
# |
|||
# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table |
|||
# |
|||
|
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1,t3,t2; |
|||
DROP FUNCTION IF EXISTS f1; |
|||
--enable_warnings |
|||
|
|||
DELIMITER |; |
|||
CREATE FUNCTION f1() RETURNS VARCHAR(250) |
|||
BEGIN |
|||
return 'hhhhhhh' ; |
|||
END| |
|||
DELIMITER ;| |
|||
|
|||
CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; |
|||
|
|||
BEGIN WORK; |
|||
|
|||
CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; |
|||
CREATE TEMPORARY TABLE t3 LIKE t2; |
|||
|
|||
INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); |
|||
|
|||
SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); |
|||
PREPARE stmt1 FROM @stmt; |
|||
|
|||
SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); |
|||
PREPARE stmt3 FROM @stmt; |
|||
|
|||
EXECUTE stmt1; |
|||
|
|||
COMMIT; |
|||
|
|||
DEALLOCATE PREPARE stmt1; |
|||
DEALLOCATE PREPARE stmt3; |
|||
|
|||
DROP TABLE t1,t3,t2; |
|||
DROP FUNCTION f1; |
|||
|
|||
# |
|||
# Bug#37016: TRUNCATE TABLE removes some rows but not all |
|||
# |
|||
|
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1,t2; |
|||
--enable_warnings |
|||
|
|||
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; |
|||
CREATE TABLE t2 (id INT PRIMARY KEY, |
|||
t1_id INT, INDEX par_ind (t1_id), |
|||
FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; |
|||
INSERT INTO t1 VALUES (1),(2); |
|||
INSERT INTO t2 VALUES (3,2); |
|||
|
|||
SET AUTOCOMMIT = 0; |
|||
|
|||
START TRANSACTION; |
|||
--error ER_ROW_IS_REFERENCED_2 |
|||
TRUNCATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
COMMIT; |
|||
SELECT * FROM t1; |
|||
|
|||
START TRANSACTION; |
|||
--error ER_ROW_IS_REFERENCED_2 |
|||
TRUNCATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
ROLLBACK; |
|||
SELECT * FROM t1; |
|||
|
|||
SET AUTOCOMMIT = 1; |
|||
|
|||
START TRANSACTION; |
|||
SELECT * FROM t1; |
|||
COMMIT; |
|||
|
|||
--error ER_ROW_IS_REFERENCED_2 |
|||
TRUNCATE TABLE t1; |
|||
SELECT * FROM t1; |
|||
DELETE FROM t2 WHERE id = 3; |
|||
|
|||
START TRANSACTION; |
|||
SELECT * FROM t1; |
|||
TRUNCATE TABLE t1; |
|||
ROLLBACK; |
|||
SELECT * FROM t1; |
|||
TRUNCATE TABLE t2; |
|||
|
|||
DROP TABLE t2; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 |
|||
--echo # |
|||
CREATE TABLE t1 ( |
|||
id INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|||
PRIMARY KEY (id) |
|||
) ENGINE=InnoDB; |
|||
|
|||
CREATE TABLE t2 ( |
|||
id INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|||
aid INT UNSIGNED NOT NULL, |
|||
PRIMARY KEY (id), |
|||
FOREIGN KEY (aid) REFERENCES t1 (id) |
|||
) ENGINE=InnoDB; |
|||
|
|||
CREATE TABLE t3 ( |
|||
bid INT UNSIGNED NOT NULL, |
|||
FOREIGN KEY (bid) REFERENCES t2 (id) |
|||
) ENGINE=InnoDB; |
|||
|
|||
CREATE TABLE t4 ( |
|||
a INT |
|||
) ENGINE=InnoDB; |
|||
|
|||
CREATE TABLE t5 ( |
|||
a INT |
|||
) ENGINE=InnoDB; |
|||
|
|||
INSERT INTO t1 (id) VALUES (1); |
|||
INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1); |
|||
INSERT INTO t3 (bid) VALUES (1); |
|||
|
|||
INSERT INTO t4 VALUES (1),(2),(3),(4),(5); |
|||
INSERT INTO t5 VALUES (1); |
|||
|
|||
DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a; |
|||
|
|||
--error ER_ROW_IS_REFERENCED_2 |
|||
DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; |
|||
--error ER_ROW_IS_REFERENCED_2 |
|||
DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; |
|||
|
|||
DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1; |
|||
|
|||
DROP TABLE t3; |
|||
DROP TABLE t2; |
|||
DROP TABLE t1; |
|||
DROP TABLES t4,t5; |
|||
|
|||
--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0 |
|||
--echo # Testing for any side effects of IGNORE on AFTER DELETE triggers used with |
|||
--echo # transactional tables. |
|||
--echo # |
|||
CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
|||
CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB; |
|||
CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
|||
CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT, |
|||
FOREIGN KEY (t1i) REFERENCES t1(i)) |
|||
ENGINE=InnoDB; |
|||
delimiter ||; |
|||
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW |
|||
BEGIN |
|||
SET @b:='EXECUTED TRIGGER'; |
|||
INSERT INTO t2 VALUES (@b); |
|||
SET @a:= error_happens_here; |
|||
END|| |
|||
delimiter ;|| |
|||
|
|||
SET @b:=""; |
|||
SET @a:=""; |
|||
INSERT INTO t1 VALUES (1),(2),(3),(4); |
|||
INSERT INTO t3 SELECT * FROM t1; |
|||
--echo ** An error in a trigger causes rollback of the statement. |
|||
--error ER_BAD_FIELD_ERROR |
|||
DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; |
|||
SELECT @a,@b; |
|||
SELECT * FROM t2; |
|||
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; |
|||
|
|||
--echo ** Same happens with the IGNORE option |
|||
--error ER_BAD_FIELD_ERROR |
|||
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; |
|||
SELECT * FROM t2; |
|||
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; |
|||
|
|||
--echo ** |
|||
--echo ** The following is an attempt to demonstrate |
|||
--echo ** error handling inside a row iteration. |
|||
--echo ** |
|||
DROP TRIGGER trg; |
|||
TRUNCATE TABLE t1; |
|||
TRUNCATE TABLE t2; |
|||
TRUNCATE TABLE t3; |
|||
|
|||
INSERT INTO t1 VALUES (1),(2),(3),(4); |
|||
INSERT INTO t3 VALUES (1),(2),(3),(4); |
|||
INSERT INTO t4 VALUES (3,3),(4,4); |
|||
|
|||
delimiter ||; |
|||
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW |
|||
BEGIN |
|||
SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR)); |
|||
INSERT INTO t2 VALUES (@b); |
|||
END|| |
|||
delimiter ;|| |
|||
|
|||
--echo ** DELETE is prevented by foreign key constrains but errors are silenced. |
|||
--echo ** The AFTER trigger isn't fired. |
|||
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; |
|||
--echo ** Tables are modified by best effort: |
|||
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; |
|||
--echo ** The AFTER trigger was only executed on successful rows: |
|||
SELECT * FROM t2; |
|||
|
|||
DROP TRIGGER trg; |
|||
|
|||
--echo ** |
|||
--echo ** Induce an error midway through an AFTER-trigger |
|||
--echo ** |
|||
TRUNCATE TABLE t4; |
|||
TRUNCATE TABLE t1; |
|||
TRUNCATE TABLE t3; |
|||
INSERT INTO t1 VALUES (1),(2),(3),(4); |
|||
INSERT INTO t3 VALUES (1),(2),(3),(4); |
|||
delimiter ||; |
|||
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW |
|||
BEGIN |
|||
SET @a:= @a+1; |
|||
IF @a > 2 THEN |
|||
INSERT INTO t4 VALUES (5,5); |
|||
END IF; |
|||
END|| |
|||
delimiter ;|| |
|||
|
|||
SET @a:=0; |
|||
--echo ** Errors in the trigger causes the statement to abort. |
|||
--error ER_NO_REFERENCED_ROW_2 |
|||
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i; |
|||
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i; |
|||
SELECT * FROM t4; |
|||
|
|||
DROP TRIGGER trg; |
|||
DROP TABLE t4; |
|||
DROP TABLE t1; |
|||
DROP TABLE t2; |
|||
DROP TABLE t3; |
|||
|
|||
# |
|||
# Bug#43580: Issue with Innodb on multi-table update |
|||
# |
|||
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB; |
|||
CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; |
|||
|
|||
CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB; |
|||
CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB; |
|||
|
|||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6); |
|||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); |
|||
|
|||
INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106); |
|||
INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); |
|||
|
|||
UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10 |
|||
WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b; |
|||
--sorted_result |
|||
SELECT * FROM t2; |
|||
|
|||
UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10 |
|||
WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100; |
|||
--sorted_result |
|||
SELECT * FROM t4; |
|||
|
|||
DROP TABLE t1, t2, t3, t4; |
|||
|
|||
--echo # |
|||
--echo # Bug#44886: SIGSEGV in test_if_skip_sort_order() - |
|||
--echo # uninitialized variable used as subscript |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c)) |
|||
ENGINE=InnoDB; |
|||
INSERT INTO t1 VALUES (1,1,1,0); |
|||
|
|||
CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB; |
|||
INSERT INTO t2 VALUES (1,1,2); |
|||
|
|||
CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM; |
|||
INSERT INTO t3 VALUES (1, 1); |
|||
|
|||
SELECT * FROM t1, t2, t3 |
|||
WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2 |
|||
GROUP BY t1.b; |
|||
|
|||
DROP TABLE t1, t2, t3; |
|||
|
|||
--echo # |
|||
--echo # Bug #45828: Optimizer won't use partial primary key if another |
|||
--echo # index can prevent filesort |
|||
--echo # |
|||
|
|||
# Create the table |
|||
CREATE TABLE `t1` ( |
|||
c1 int NOT NULL, |
|||
c2 int NOT NULL, |
|||
c3 int NOT NULL, |
|||
PRIMARY KEY (c1,c2), |
|||
KEY (c3) |
|||
) ENGINE=InnoDB; |
|||
|
|||
# populate with data |
|||
INSERT INTO t1 VALUES (5,2,1246276747); |
|||
INSERT INTO t1 VALUES (2,1,1246281721); |
|||
INSERT INTO t1 VALUES (7,3,1246281756); |
|||
INSERT INTO t1 VALUES (4,2,1246282139); |
|||
INSERT INTO t1 VALUES (3,1,1246282230); |
|||
INSERT INTO t1 VALUES (1,0,1246282712); |
|||
INSERT INTO t1 VALUES (8,3,1246282765); |
|||
INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1; |
|||
INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1; |
|||
INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1; |
|||
INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1; |
|||
INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1; |
|||
INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1; |
|||
|
|||
# query and no rows will match the c1 condition, whereas all will match c3 |
|||
SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; |
|||
|
|||
# SHOULD use the pk. |
|||
# index on c3 will be used instead of primary key |
|||
EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; |
|||
|
|||
# if we force the primary key, we can see the estimate is 1 |
|||
EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; |
|||
|
|||
|
|||
CREATE TABLE t2 ( |
|||
c1 int NOT NULL, |
|||
c2 int NOT NULL, |
|||
c3 int NOT NULL, |
|||
KEY (c1,c2), |
|||
KEY (c3) |
|||
) ENGINE=InnoDB; |
|||
|
|||
# SHOULD use the pk. |
|||
# if we switch it from a primary key to a regular index, it works correctly as well |
|||
explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3; |
|||
|
|||
DROP TABLE t1,t2; |
|||
|
|||
|
|||
--echo # |
|||
--echo # 36259: Optimizing with ORDER BY |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 ( |
|||
a INT NOT NULL AUTO_INCREMENT, |
|||
b INT NOT NULL, |
|||
c INT NOT NULL, |
|||
d VARCHAR(5), |
|||
e INT NOT NULL, |
|||
PRIMARY KEY (a), KEY i2 (b,c,d) |
|||
) ENGINE=InnoDB; |
|||
|
|||
INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2); |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1; |
|||
EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a; |
|||
EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a; |
|||
EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a; |
|||
|
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Bug #47963: Wrong results when index is used |
|||
--echo # |
|||
CREATE TABLE t1( |
|||
a VARCHAR(5) NOT NULL, |
|||
b VARCHAR(5) NOT NULL, |
|||
c DATETIME NOT NULL, |
|||
KEY (c) |
|||
) ENGINE=InnoDB; |
|||
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00'); |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001'; |
|||
SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; |
|||
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND |
|||
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00'; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Bug #46175: NULL read_view and consistent read assertion |
|||
--echo # |
|||
|
|||
CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb; |
|||
CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb; |
|||
INSERT INTO t1 VALUES (),(); |
|||
INSERT INTO t2 VALUES (),(); |
|||
CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2 |
|||
WHERE b =(SELECT a FROM t1 LIMIT 1); |
|||
|
|||
--disable_query_log |
|||
--disable_result_log |
|||
CONNECT (con1, localhost, root,,); |
|||
--enable_query_log |
|||
--enable_result_log |
|||
CONNECTION default; |
|||
|
|||
DELIMITER |; |
|||
CREATE PROCEDURE p1(num INT) |
|||
BEGIN |
|||
DECLARE i INT DEFAULT 0; |
|||
REPEAT |
|||
SHOW CREATE VIEW v1; |
|||
SET i:=i+1; |
|||
UNTIL i>num END REPEAT; |
|||
END| |
|||
DELIMITER ;| |
|||
|
|||
--echo # Should not crash |
|||
--disable_query_log |
|||
--disable_result_log |
|||
--send CALL p1(1000) |
|||
CONNECTION con1; |
|||
--echo # Should not crash |
|||
CALL p1(1000); |
|||
|
|||
CONNECTION default; |
|||
--reap |
|||
--enable_query_log |
|||
--enable_result_log |
|||
|
|||
DISCONNECT con1; |
|||
DROP PROCEDURE p1; |
|||
DROP VIEW v1; |
|||
DROP TABLE t1,t2; |
|||
|
|||
|
|||
--echo # |
|||
--echo # Bug #49324: more valgrind errors in test_if_skip_sort_order |
|||
--echo # |
|||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ; |
|||
--echo #should not cause valgrind warnings |
|||
SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a; |
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Bug#50843: Filesort used instead of clustered index led to |
|||
--echo # performance degradation. |
|||
--echo # |
|||
create table t1(f1 int not null primary key, f2 int) engine=innodb; |
|||
create table t2(f1 int not null, key (f1)) engine=innodb; |
|||
insert into t1 values (1,1),(2,2),(3,3); |
|||
insert into t2 values (1),(2),(3); |
|||
explain select t1.* from t1 left join t2 using(f1) group by t1.f1; |
|||
drop table t1,t2; |
|||
--echo # |
|||
|
|||
|
|||
--echo # |
|||
--echo # Bug #39653: find_shortest_key in sql_select.cc does not consider |
|||
--echo # clustered primary keys |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT, |
|||
KEY (b,c)) ENGINE=INNODB; |
|||
|
|||
INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3), |
|||
(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6), |
|||
(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9), |
|||
(11,11,11,11,11,11); |
|||
|
|||
--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 |
|||
|
|||
DROP TABLE t1; |
|||
|
|||
--echo # |
|||
--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may |
|||
--echo # corrupt definition at engine |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b)) |
|||
ENGINE=InnoDB; |
|||
|
|||
ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); |
|||
|
|||
--query_vertical SHOW INDEXES FROM t1; |
|||
|
|||
DROP TABLE t1; |
|||
|
|||
|
|||
--echo # |
|||
--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when |
|||
--echo # JOINed during an UPDATE |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (d INT) ENGINE=InnoDB; |
|||
CREATE TABLE t2 (a INT, b INT, |
|||
c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP |
|||
ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; |
|||
|
|||
--echo set up our data elements |
|||
INSERT INTO t1 (d) VALUES (1); |
|||
INSERT INTO t2 (a,b) VALUES (1,1); |
|||
SELECT SECOND(c) INTO @bug47453 FROM t2; |
|||
|
|||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; |
|||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; |
|||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; |
|||
|
|||
SELECT SLEEP(1); |
|||
|
|||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; |
|||
|
|||
--echo #should be 0 |
|||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; |
|||
|
|||
DROP TABLE t1, t2; |
|||
|
|||
--echo # |
|||
--echo # Bug#38999 valgrind warnings for update statement in function compare_record() |
|||
--echo # |
|||
|
|||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
|||
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
|||
INSERT INTO t1 values (1),(2),(3),(4),(5); |
|||
INSERT INTO t2 values (1); |
|||
|
|||
SELECT * FROM t1 WHERE a = 2; |
|||
UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1; |
|||
|
|||
DROP TABLE t1,t2; |
|||
|
|||
--echo End of 5.1 tests |
|||
@ -0,0 +1 @@ |
|||
--innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 |
|||
@ -0,0 +1,35 @@ |
|||
-- source include/have_innodb_plugin.inc |
|||
|
|||
# |
|||
# Bug #41453: Assertion `m_status == DA_ERROR' failed in |
|||
# Diagnostics_area::sql_errno |
|||
# |
|||
|
|||
CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb |
|||
DEFAULT CHARSET=latin1; |
|||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); |
|||
CONNECT (con1,localhost,root,,); |
|||
CONNECT (con2,localhost,root,,); |
|||
|
|||
CONNECTION con1; |
|||
START TRANSACTION; |
|||
SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; |
|||
CONNECTION con2; |
|||
START TRANSACTION; |
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; |
|||
ROLLBACK; |
|||
|
|||
CONNECTION con1; |
|||
START TRANSACTION; |
|||
SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; |
|||
CONNECTION con2; |
|||
START TRANSACTION; |
|||
--error ER_LOCK_WAIT_TIMEOUT |
|||
UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; |
|||
SELECT * FROM t1 WHERE b = 10; |
|||
|
|||
CONNECTION default; |
|||
DISCONNECT con1; |
|||
DISCONNECT con2; |
|||
DROP TABLE t1; |
|||
@ -0,0 +1,50 @@ |
|||
-- source include/not_embedded.inc |
|||
-- source include/have_innodb_plugin.inc |
|||
|
|||
--disable_warnings |
|||
drop table if exists t1; |
|||
--enable_warnings |
|||
|
|||
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; |
|||
|
|||
connect (a,localhost,root,,); |
|||
connect (b,localhost,root,,); |
|||
|
|||
|
|||
# |
|||
# BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to |
|||
# non-blocking SELECT |
|||
# |
|||
SET GLOBAL log_bin_trust_function_creators = 1; |
|||
create table t1 (col1 integer primary key, col2 integer) engine=innodb; |
|||
insert t1 values (1,100); |
|||
delimiter |; |
|||
create function f1 () returns integer begin |
|||
declare var1 int; |
|||
select col2 into var1 from t1 where col1=1 for update; |
|||
return var1; |
|||
end| |
|||
delimiter ;| |
|||
start transaction; |
|||
select f1(); |
|||
connection b; |
|||
send update t1 set col2=0 where col1=1; |
|||
connection default; |
|||
select * from t1; |
|||
connection a; |
|||
rollback; |
|||
connection b; |
|||
reap; |
|||
rollback; |
|||
|
|||
# Cleanup |
|||
connection a; |
|||
disconnect a; |
|||
--source include/wait_until_disconnected.inc |
|||
connection b; |
|||
disconnect b; |
|||
--source include/wait_until_disconnected.inc |
|||
connection default; |
|||
drop table t1; |
|||
drop function f1; |
|||
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; |
|||
@ -0,0 +1 @@ |
|||
--innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout |
|||
@ -0,0 +1,5 @@ |
|||
-- source include/have_innodb_plugin.inc |
|||
|
|||
--source include/innodb_rollback_on_timeout.inc |
|||
|
|||
--echo End of 5.0 tests |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue