~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/mix1.inc

Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mkel <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#
27
27
 
28
28
eval SET SESSION STORAGE_ENGINE = $engine_type;
 
29
SET @orig_lock_wait_timeout= @@innodb_lock_wait_timeout; 
 
30
SET GLOBAL innodb_lock_wait_timeout=2;
 
31
 
29
32
 
30
33
--disable_warnings
31
34
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
182
185
CREATE TABLE t1 (
183
186
  a1 decimal(10,0) DEFAULT NULL,
184
187
  a2 blob,
185
 
  a3 time DEFAULT NULL,
186
188
  a4 blob,
187
189
  a5 char(175) DEFAULT NULL,
188
 
  a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 
190
  a6 timestamp NOT NULL DEFAULT NOW(),
189
191
  a7 blob,
190
192
  INDEX idx (a6,a7(239),a5)
191
193
) ENGINE=InnoDB;
205
207
#
206
208
 
207
209
--disable_warnings
208
 
eval create table t1m (a int) engine = $other_engine_type;
 
210
eval create temporary table t1m (a int) engine = $other_engine_type;
209
211
create table t1i (a int);
210
 
eval create table t2m (a int) engine = $other_engine_type;
 
212
eval create temporary table t2m (a int) engine = $other_engine_type;
211
213
create table t2i (a int);
212
214
--enable_warnings
213
215
insert into t2m values (5);
240
242
# (was part of group_min_max.test)
241
243
#
242
244
 
243
 
eval create table t1 (
 
245
eval create TEMPORARY table t1 (
244
246
  a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
245
247
) ENGINE = $other_engine_type;
246
248
 
406
408
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
407
409
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
408
410
DELETE FROM t1;
 
411
--replace_column 9 #
409
412
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
410
413
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
411
414
 
542
545
# Bug #28652: assert when alter innodb table operation
543
546
#
544
547
create table t1(a int) engine=innodb;
545
 
alter table t1 comment '123';
 
548
alter table t1 comment='123';
546
549
show create table t1;
547
550
drop table t1;
548
551
 
566
569
UPDATE t2 SET a = 'us' WHERE a = 'uk';
567
570
SELECT * FROM t2 WHERE a = 'uk';
568
571
 
569
 
CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
 
572
CREATE TEMPORARY TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
570
573
INSERT INTO t3 VALUES ('uk'),('bg');
571
574
SELECT * FROM t3 WHERE a = 'uk';
572
575
DELETE FROM t3 WHERE a = 'uk';
578
581
DROP TABLE t1,t2,t3;
579
582
 
580
583
#
581
 
# Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked
582
 
#
583
 
 
584
 
CREATE TABLE t1 (a INT) ENGINE=InnoDB; 
585
 
CREATE TABLE t2 (a INT) ENGINE=InnoDB; 
586
 
 
587
 
CONNECT (c1,localhost,root,,);
588
 
CONNECT (c2,localhost,root,,);
589
 
 
590
 
--echo switch to connection c1
591
 
CONNECTION c1;
592
 
SET AUTOCOMMIT=0;
593
 
INSERT INTO t2 VALUES (1);
594
 
 
595
 
--echo switch to connection c2
596
 
CONNECTION c2;
597
 
SET AUTOCOMMIT=0;
598
 
--error ER_LOCK_WAIT_TIMEOUT
599
 
LOCK TABLES t1 READ, t2 READ;
600
 
 
601
 
--echo switch to connection c1
602
 
CONNECTION c1;
603
 
COMMIT;
604
 
INSERT INTO t1 VALUES (1);
605
 
 
606
 
--echo switch to connection default
607
 
CONNECTION default;
608
 
SET AUTOCOMMIT=default;
609
 
DISCONNECT c1;
610
 
DISCONNECT c2;
611
 
DROP TABLE t1,t2;
612
 
 
613
 
#
614
584
# Bug #25798: a query with forced index merge returns wrong result 
615
585
#
616
586
 
625
595
CREATE TABLE t2 (
626
596
  b int NOT NULL auto_increment PRIMARY KEY,
627
597
  c datetime NOT NULL
628
 
) ENGINE= MyISAM;
 
598
) ENGINE= InnoDB;
629
599
 
630
600
INSERT INTO t2(c) VALUES ('2007-01-01');
631
601
INSERT INTO t2(c) SELECT c FROM t2;
743
713
--source include/innodb_rollback_on_timeout.inc
744
714
 
745
715
#
746
 
# Bug#27296 Assertion in ALTER TABLE SET DEFAULT in Linux Debug build
747
 
# (possible deadlock).
748
 
#
749
 
# The bug is applicable only to a transactoinal table.
750
 
# Cover with tests behavior that no longer causes an
751
 
# assertion.
752
 
#
753
 
--disable_warnings
754
 
drop table if exists t1;
755
 
--enable_warnings
756
 
create table t1 (a int) engine=innodb;
757
 
alter table t1 alter a set default 1;
758
 
drop table t1;
759
 
 
760
 
--echo
761
 
--echo Bug#24918 drop table and lock / inconsistent between 
762
 
--echo perm and temp tables
763
 
--echo
764
 
--echo Check transactional tables under LOCK TABLES
765
 
--echo
766
 
--disable_warnings
767
 
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, 
768
 
t24918_access;
769
 
--enable_warnings
770
 
create table t24918_access (id int);
771
 
create table t24918 (id int) engine=myisam;
772
 
create temporary table t24918_tmp (id int) engine=myisam;
773
 
create table t24918_trans (id int) engine=innodb;
774
 
create temporary table t24918_trans_tmp (id int) engine=innodb;
775
 
 
776
 
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
777
 
drop table t24918;
778
 
--error ER_TABLE_NOT_LOCKED
779
 
select * from t24918_access;
780
 
drop table t24918_trans;
781
 
--error ER_TABLE_NOT_LOCKED
782
 
select * from t24918_access;
783
 
drop table t24918_trans_tmp;
784
 
--error ER_TABLE_NOT_LOCKED
785
 
select * from t24918_access;
786
 
drop table t24918_tmp;
787
 
--error ER_TABLE_NOT_LOCKED
788
 
select * from t24918_access;
789
 
unlock tables;
790
 
 
791
 
drop table t24918_access;
792
 
#
793
716
# Bug #28591: MySQL need not sort the records in case of ORDER BY
794
717
# primary_key on InnoDB table
795
718
#
938
861
--echo
939
862
 
940
863
SELECT table_schema, table_name, row_format
941
 
FROM INFORMATION_SCHEMA.TABLES
 
864
FROM data_dictionary.TABLES
942
865
WHERE table_schema = DATABASE() AND table_name = 't1';
943
866
 
944
867
--echo
950
873
--echo
951
874
 
952
875
SELECT table_schema, table_name, row_format
953
 
FROM INFORMATION_SCHEMA.TABLES
 
876
FROM data_dictionary.TABLES
954
877
WHERE table_schema = DATABASE() AND table_name = 't1';
955
878
 
956
879
--echo
1052
975
 
1053
976
 
1054
977
#
1055
 
# Tests for bug #28415 "Some ALTER TABLE statements no longer work
1056
 
# under LOCK TABLES" and some aspects of fast ALTER TABLE behaviour
1057
 
# for transactional tables.
1058
 
#
1059
 
--disable_warnings
1060
 
drop table if exists t1, t2;
1061
 
--enable_warnings
1062
 
create table t1 (i int);
1063
 
alter table t1 modify i int default 1;
1064
 
alter table t1 modify i int default 2, rename t2;
1065
 
lock table t2 write;
1066
 
alter table t2 modify i int default 3;
1067
 
unlock tables;
1068
 
lock table t2 write;
1069
 
alter table t2 modify i int default 4, rename t1;
1070
 
unlock tables;
1071
 
drop table t1;
1072
 
 
1073
 
 
1074
 
1075
 
# Some more tests for ALTER TABLE and LOCK TABLES for transactional tables.
1076
 
#
1077
 
# Table which is altered under LOCK TABLES should stay in list of locked
1078
 
# tables and be available after alter takes place unless ALTER contains
1079
 
# RENAME clause. We should see the new definition of table, of course.
1080
 
# Before 5.1 this behavior was inconsistent across the platforms and
1081
 
# different engines. See also tests in alter_table.test
1082
 
#
1083
 
--disable_warnings
1084
 
drop table if exists t1;
1085
 
--enable_warnings
1086
 
create table t1 (i int);
1087
 
insert into t1 values ();
1088
 
lock table t1 write;
1089
 
# Example of so-called 'fast' ALTER TABLE
1090
 
alter table t1 modify i int default 1;
1091
 
insert into t1 values ();
1092
 
select * from t1;
1093
 
# And now full-blown ALTER TABLE
1094
 
alter table t1 change i c char(10) default "Two";
1095
 
insert into t1 values ();
1096
 
select * from t1;
1097
 
unlock tables;
1098
 
select * from t1;
1099
 
drop tables t1;
1100
 
 
1101
 
#
1102
978
# Bug#29310: An InnoDB table was updated when the data wasn't actually changed.
1103
979
#
1104
980
create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT
1106
982
insert into t1(f1) values(1);
1107
983
--replace_column 1 #
1108
984
select @a:=f2 from t1;
1109
 
--sleep 5
1110
985
update t1 set f1=1;
1111
986
--replace_column 1 #
1112
987
select @b:=f2 from t1;
1113
988
select if(@a=@b,"ok","wrong");
1114
 
--sleep 5
1115
989
insert into t1(f1) values (1) on duplicate key update f1="1";
1116
990
--replace_column 1 #
1117
991
select @b:=f2 from t1;
1118
992
select if(@a=@b,"ok","wrong");
1119
 
--sleep 5
1120
993
insert into t1(f1) select f1 from t1 on duplicate key update f1="1";
1121
994
--replace_column 1 #
1122
995
select @b:=f2 from t1;
1222
1095
DROP TABLE t2;
1223
1096
DROP TABLE t1;
1224
1097
 
 
1098
SET innodb_lock_wait_timeout=@orig_lock_wait_timeout ;
 
1099
 
1225
1100
--echo End of 5.1 tests