~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/mix1.inc

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

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
 
 
32
29
 
33
30
--disable_warnings
34
31
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
38
35
# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
39
36
# (repeatable only w/innodb).
40
37
create table t1 (
41
 
  c_id int not null default '0',
42
 
  org_id int default null,
 
38
  c_id int(11) not null default '0',
 
39
  org_id int(11) default null,
43
40
  unique key contacts$c_id (c_id),
44
41
  key contacts$org_id (org_id)
45
42
);
49
46
  (246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
50
47
 
51
48
create table t2 (
52
 
  slai_id int not null default '0',
53
 
  owner_tbl int default null,
54
 
  owner_id int default null,
55
 
  sla_id int default null,
56
 
  inc_web int default null,
57
 
  inc_email int default null,
58
 
  inc_chat int default null,
59
 
  inc_csr int default null,
60
 
  inc_total int default null,
61
 
  time_billed int default null,
 
49
  slai_id int(11) not null default '0',
 
50
  owner_tbl int(11) default null,
 
51
  owner_id int(11) default null,
 
52
  sla_id int(11) default null,
 
53
  inc_web int(11) default null,
 
54
  inc_email int(11) default null,
 
55
  inc_chat int(11) default null,
 
56
  inc_csr int(11) default null,
 
57
  inc_total int(11) default null,
 
58
  time_billed int(11) default null,
62
59
  activedate timestamp null default null,
63
60
  expiredate timestamp null default null,
64
 
  state int default null,
65
 
  sla_set int default null,
 
61
  state int(11) default null,
 
62
  sla_set int(11) default null,
66
63
  unique key t2$slai_id (slai_id),
67
64
  key t2$owner_id (owner_id),
68
65
  key t2$sla_id (sla_id)
112
109
 
113
110
# demonstrate a problem when a must-use-sort table flag
114
111
# (sort_by_table=1) is being neglected.
115
 
SELECT STRAIGHT_JOIN t1.b, t1.a FROM t1, t3, t2 WHERE
 
112
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
116
113
  t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
117
114
  ORDER BY t1.b LIMIT 2;
118
115
 
119
116
# demonstrate the problem described in the bug report
120
 
SELECT STRAIGHT_JOIN t1.b, t1.a FROM t1, t3, t2 WHERE
 
117
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
121
118
  t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
122
119
  ORDER BY t1.b LIMIT 5;
123
120
DROP TABLE t1, t2, t3;
155
152
#
156
153
 
157
154
CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1)
158
 
  ENGINE=INNODB;
 
155
  ENGINE=INNODB CHARACTER SET UTF8;
159
156
INSERT INTO t1 (c1) VALUES ('1a');
160
157
SELECT * FROM t1;
161
158
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
163
160
DROP TABLE t1;
164
161
 
165
162
CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
166
 
  ENGINE=INNODB;
 
163
  ENGINE=INNODB CHARACTER SET UTF8;
167
164
INSERT INTO t1 (c1) VALUES ('1a');
168
165
SELECT * FROM t1;
169
166
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
171
168
DROP TABLE t1;
172
169
 
173
170
CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
174
 
  ENGINE=INNODB;
 
171
  ENGINE=INNODB CHARACTER SET UTF8;
175
172
INSERT INTO t1 (c1) VALUES ('1a');
176
173
SELECT * FROM t1;
177
174
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
185
182
CREATE TABLE t1 (
186
183
  a1 decimal(10,0) DEFAULT NULL,
187
184
  a2 blob,
 
185
  a3 time DEFAULT NULL,
188
186
  a4 blob,
189
187
  a5 char(175) DEFAULT NULL,
190
 
  a6 timestamp NOT NULL DEFAULT NOW(),
191
 
  a7 blob,
 
188
  a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 
189
  a7 tinyblob,
192
190
  INDEX idx (a6,a7(239),a5)
193
191
) ENGINE=InnoDB;
194
192
 
207
205
#
208
206
 
209
207
--disable_warnings
210
 
eval create temporary table t1m (a int) engine = $other_engine_type;
 
208
eval create table t1m (a int) engine = $other_engine_type;
211
209
create table t1i (a int);
212
 
eval create temporary table t2m (a int) engine = $other_engine_type;
 
210
eval create table t2m (a int) engine = $other_engine_type;
213
211
create table t2i (a int);
214
212
--enable_warnings
215
213
insert into t2m values (5);
242
240
# (was part of group_min_max.test)
243
241
#
244
242
 
245
 
eval create TEMPORARY table t1 (
 
243
eval create table t1 (
246
244
  a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
247
245
) ENGINE = $other_engine_type;
248
246
 
365
363
# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
366
364
#
367
365
 
368
 
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, name varchar(20),
 
366
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
369
367
                 INDEX (name));
370
 
CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, fkey int);
371
 
# CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, fkey int,
 
368
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11));
 
369
# CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
372
370
#                  FOREIGN KEY (fkey) REFERENCES t2(id));
373
371
if ($test_foreign_keys)
374
372
{
395
393
  id int NOT NULL,
396
394
  name varchar(20) NOT NULL,
397
395
  dept varchar(20) NOT NULL,
398
 
  age int NOT NULL,
 
396
  age tinyint(3) NOT NULL,
399
397
  PRIMARY KEY (id),
400
398
  INDEX (name,dept)
401
399
) ENGINE=InnoDB;
408
406
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
409
407
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
410
408
DELETE FROM t1;
411
 
--replace_column 9 #
412
409
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
413
410
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
414
411
 
425
422
drop table if exists `test`;
426
423
CREATE TABLE `test` (`test1` varchar(3) NOT NULL,
427
424
  `test2` varchar(4) NOT NULL,PRIMARY KEY  (`test1`))
428
 
  ENGINE=InnoDB;
 
425
  ENGINE=InnoDB DEFAULT CHARSET=latin1;
429
426
INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '5678');
430
427
disconnect con1;
431
428
connect (con2,localhost,root,,);
486
483
 
487
484
drop table t1;
488
485
 
489
 
# Test needs to be rewritten to not use divide by zero
490
 
##
491
 
## Bug #28189: optimizer erroniously prefers ref access to range access 
492
 
##             for an InnoDB table
493
 
##
494
 
#
495
 
#CREATE TABLE t1(
496
 
#  id int AUTO_INCREMENT PRIMARY KEY,
497
 
#  stat_id int NOT NULL,
498
 
#  acct_id int DEFAULT NULL,
499
 
#  INDEX idx1 (stat_id, acct_id),
500
 
#  INDEX idx2 (acct_id)
501
 
#) ENGINE=MyISAM;
502
 
#
503
 
#CREATE TABLE t2(
504
 
#  id int AUTO_INCREMENT PRIMARY KEY,
505
 
#  stat_id int NOT NULL,
506
 
#  acct_id int DEFAULT NULL,
507
 
#  INDEX idx1 (stat_id, acct_id),
508
 
#  INDEX idx2 (acct_id)
509
 
#) ENGINE=InnoDB;
510
 
#
511
 
#INSERT INTO t1(stat_id,acct_id) VALUES
512
 
#  (1,759), (2,831), (3,785), (4,854), (1,921),
513
 
#  (1,553), (2,589), (3,743), (2,827), (2,545),
514
 
#  (4,779), (4,783), (1,597), (1,785), (4,832),
515
 
#  (1,741), (1,833), (3,788), (2,973), (1,907);
516
 
#
517
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
518
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
519
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
520
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
521
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
522
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
523
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
524
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
525
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
526
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
527
 
#INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
528
 
#UPDATE t1 SET acct_id=785 
529
 
#  WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id);
530
 
#OPTIMIZE TABLE t1;
531
 
#
532
 
#SELECT COUNT(*) FROM t1;
533
 
#SELECT COUNT(*) FROM t1 WHERE acct_id=785;
534
 
#
535
 
#EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; 
536
 
#
537
 
#INSERT INTO t2 SELECT * FROM t1;
538
 
#OPTIMIZE TABLE t2;
539
 
#
540
 
#EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
541
 
#
542
 
#DROP TABLE t1,t2; 
543
 
#
 
486
#
 
487
# Bug #28189: optimizer erroniously prefers ref access to range access 
 
488
#             for an InnoDB table
 
489
#
 
490
 
 
491
CREATE TABLE t1(
 
492
  id int AUTO_INCREMENT PRIMARY KEY,
 
493
  stat_id int NOT NULL,
 
494
  acct_id int DEFAULT NULL,
 
495
  INDEX idx1 (stat_id, acct_id),
 
496
  INDEX idx2 (acct_id)
 
497
) ENGINE=MyISAM;
 
498
 
 
499
CREATE TABLE t2(
 
500
  id int AUTO_INCREMENT PRIMARY KEY,
 
501
  stat_id int NOT NULL,
 
502
  acct_id int DEFAULT NULL,
 
503
  INDEX idx1 (stat_id, acct_id),
 
504
  INDEX idx2 (acct_id)
 
505
) ENGINE=InnoDB;
 
506
 
 
507
INSERT INTO t1(stat_id,acct_id) VALUES
 
508
  (1,759), (2,831), (3,785), (4,854), (1,921),
 
509
  (1,553), (2,589), (3,743), (2,827), (2,545),
 
510
  (4,779), (4,783), (1,597), (1,785), (4,832),
 
511
  (1,741), (1,833), (3,788), (2,973), (1,907);
 
512
 
 
513
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
514
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
515
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
516
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
517
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
518
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
519
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
520
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
521
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
522
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
523
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
 
524
UPDATE t1 SET acct_id=785 
 
525
  WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id);
 
526
OPTIMIZE TABLE t1;
 
527
 
 
528
SELECT COUNT(*) FROM t1;
 
529
SELECT COUNT(*) FROM t1 WHERE acct_id=785;
 
530
 
 
531
EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; 
 
532
 
 
533
INSERT INTO t2 SELECT * FROM t1;
 
534
OPTIMIZE TABLE t2;
 
535
 
 
536
EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
 
537
 
 
538
DROP TABLE t1,t2; 
 
539
 
544
540
#
545
541
# Bug #28652: assert when alter innodb table operation
546
542
#
547
543
create table t1(a int) engine=innodb;
548
 
alter table t1 comment='123';
 
544
alter table t1 comment '123';
549
545
show create table t1;
550
546
drop table t1;
551
547
 
552
548
#
553
549
# Bug #25866: Getting "#HY000 Can't find record in..." on and INSERT
554
550
#
555
 
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
 
551
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
556
552
INSERT INTO t1 VALUES ('uk'),('bg');
557
553
SELECT * FROM t1 WHERE a = 'uk';
558
554
DELETE FROM t1 WHERE a = 'uk';
569
565
UPDATE t2 SET a = 'us' WHERE a = 'uk';
570
566
SELECT * FROM t2 WHERE a = 'uk';
571
567
 
572
 
CREATE TEMPORARY TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
 
568
CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
573
569
INSERT INTO t3 VALUES ('uk'),('bg');
574
570
SELECT * FROM t3 WHERE a = 'uk';
575
571
DELETE FROM t3 WHERE a = 'uk';
581
577
DROP TABLE t1,t2,t3;
582
578
 
583
579
#
 
580
# Test bug when trying to drop data file which no InnoDB directory entry
 
581
#
 
582
 
 
583
create table t1 (a int) engine=innodb;
 
584
copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/bug29807.frm;
 
585
--error 1146
 
586
select * from bug29807;
 
587
drop table t1;
 
588
--error 1051
 
589
drop table bug29807;
 
590
create table bug29807 (a int);
 
591
drop table bug29807;
 
592
 
 
593
 
 
594
#
 
595
# Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked
 
596
#
 
597
 
 
598
CREATE TABLE t1 (a INT) ENGINE=InnoDB; 
 
599
CREATE TABLE t2 (a INT) ENGINE=InnoDB; 
 
600
 
 
601
CONNECT (c1,localhost,root,,);
 
602
CONNECT (c2,localhost,root,,);
 
603
 
 
604
--echo switch to connection c1
 
605
CONNECTION c1;
 
606
SET AUTOCOMMIT=0;
 
607
INSERT INTO t2 VALUES (1);
 
608
 
 
609
--echo switch to connection c2
 
610
CONNECTION c2;
 
611
SET AUTOCOMMIT=0;
 
612
--error ER_LOCK_WAIT_TIMEOUT
 
613
LOCK TABLES t1 READ, t2 READ;
 
614
 
 
615
--echo switch to connection c1
 
616
CONNECTION c1;
 
617
COMMIT;
 
618
INSERT INTO t1 VALUES (1);
 
619
 
 
620
--echo switch to connection default
 
621
CONNECTION default;
 
622
SET AUTOCOMMIT=default;
 
623
DISCONNECT c1;
 
624
DISCONNECT c2;
 
625
DROP TABLE t1,t2;
 
626
 
 
627
#
584
628
# Bug #25798: a query with forced index merge returns wrong result 
585
629
#
586
630
 
595
639
CREATE TABLE t2 (
596
640
  b int NOT NULL auto_increment PRIMARY KEY,
597
641
  c datetime NOT NULL
598
 
) ENGINE= InnoDB;
 
642
) ENGINE= MyISAM;
599
643
 
600
644
INSERT INTO t2(c) VALUES ('2007-01-01');
601
645
INSERT INTO t2(c) SELECT c FROM t2;
687
731
#
688
732
# Bug#17530: Incorrect key truncation on table creation caused server crash.
689
733
#
690
 
create table t1(f1 varchar(800) not null, key(f1));
 
734
create table t1(f1 varchar(800) binary not null, key(f1))
 
735
  character set utf8 collate utf8_general_ci;
691
736
insert into t1 values('aaa');
692
737
drop table t1;
693
738
 
713
758
--source include/innodb_rollback_on_timeout.inc
714
759
 
715
760
#
 
761
# Bug#27296 Assertion in ALTER TABLE SET DEFAULT in Linux Debug build
 
762
# (possible deadlock).
 
763
#
 
764
# The bug is applicable only to a transactoinal table.
 
765
# Cover with tests behavior that no longer causes an
 
766
# assertion.
 
767
#
 
768
--disable_warnings
 
769
drop table if exists t1;
 
770
--enable_warnings
 
771
create table t1 (a int) engine=innodb;
 
772
alter table t1 alter a set default 1;
 
773
drop table t1;
 
774
 
 
775
--echo
 
776
--echo Bug#24918 drop table and lock / inconsistent between 
 
777
--echo perm and temp tables
 
778
--echo
 
779
--echo Check transactional tables under LOCK TABLES
 
780
--echo
 
781
--disable_warnings
 
782
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, 
 
783
t24918_access;
 
784
--enable_warnings
 
785
create table t24918_access (id int);
 
786
create table t24918 (id int) engine=myisam;
 
787
create temporary table t24918_tmp (id int) engine=myisam;
 
788
create table t24918_trans (id int) engine=innodb;
 
789
create temporary table t24918_trans_tmp (id int) engine=innodb;
 
790
 
 
791
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
 
792
drop table t24918;
 
793
--error ER_TABLE_NOT_LOCKED
 
794
select * from t24918_access;
 
795
drop table t24918_trans;
 
796
--error ER_TABLE_NOT_LOCKED
 
797
select * from t24918_access;
 
798
drop table t24918_trans_tmp;
 
799
--error ER_TABLE_NOT_LOCKED
 
800
select * from t24918_access;
 
801
drop table t24918_tmp;
 
802
--error ER_TABLE_NOT_LOCKED
 
803
select * from t24918_access;
 
804
unlock tables;
 
805
 
 
806
drop table t24918_access;
 
807
#
716
808
# Bug #28591: MySQL need not sort the records in case of ORDER BY
717
809
# primary_key on InnoDB table
718
810
#
749
841
#
750
842
# Bug #28125: ERROR 2013 when adding index.
751
843
#
752
 
create table t1(a text) engine=innodb;
 
844
create table t1(a text) engine=innodb default charset=utf8; 
753
845
insert into t1 values('aaa');
754
846
alter table t1 add index(a(1024));
755
847
show create table t1;
861
953
--echo
862
954
 
863
955
SELECT table_schema, table_name, row_format
864
 
FROM data_dictionary.TABLES
 
956
FROM INFORMATION_SCHEMA.TABLES
865
957
WHERE table_schema = DATABASE() AND table_name = 't1';
866
958
 
867
959
--echo
873
965
--echo
874
966
 
875
967
SELECT table_schema, table_name, row_format
876
 
FROM data_dictionary.TABLES
 
968
FROM INFORMATION_SCHEMA.TABLES
877
969
WHERE table_schema = DATABASE() AND table_name = 't1';
878
970
 
879
971
--echo
915
1007
set global innodb_autoextend_increment=8;
916
1008
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
917
1009
 
918
 
# BUG: 
919
 
# set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
920
 
# set global innodb_commit_concurrency=0;
921
 
# set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
 
1010
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
 
1011
set global innodb_commit_concurrency=0;
 
1012
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
922
1013
 
923
1014
--echo End of 5.0 tests
924
1015
 
926
1017
# UPDATE": if the row is updated, it's like a regular UPDATE:
927
1018
# LAST_INSERT_ID() is not affected.
928
1019
CREATE TABLE `t2` (
929
 
  `k` int NOT NULL auto_increment,
930
 
  `a` int default NULL,
931
 
  `c` int default NULL,
 
1020
  `k` int(11) NOT NULL auto_increment,
 
1021
  `a` int(11) default NULL,
 
1022
  `c` int(11) default NULL,
932
1023
  PRIMARY KEY  (`k`),
933
1024
  UNIQUE KEY `idx_1` (`a`)
934
1025
);
976
1067
 
977
1068
 
978
1069
#
 
1070
# Tests for bug #28415 "Some ALTER TABLE statements no longer work
 
1071
# under LOCK TABLES" and some aspects of fast ALTER TABLE behaviour
 
1072
# for transactional tables.
 
1073
#
 
1074
--disable_warnings
 
1075
drop table if exists t1, t2;
 
1076
--enable_warnings
 
1077
create table t1 (i int);
 
1078
alter table t1 modify i int default 1;
 
1079
alter table t1 modify i int default 2, rename t2;
 
1080
lock table t2 write;
 
1081
alter table t2 modify i int default 3;
 
1082
unlock tables;
 
1083
lock table t2 write;
 
1084
alter table t2 modify i int default 4, rename t1;
 
1085
unlock tables;
 
1086
drop table t1;
 
1087
 
 
1088
 
 
1089
 
1090
# Some more tests for ALTER TABLE and LOCK TABLES for transactional tables.
 
1091
#
 
1092
# Table which is altered under LOCK TABLES should stay in list of locked
 
1093
# tables and be available after alter takes place unless ALTER contains
 
1094
# RENAME clause. We should see the new definition of table, of course.
 
1095
# Before 5.1 this behavior was inconsistent across the platforms and
 
1096
# different engines. See also tests in alter_table.test
 
1097
#
 
1098
--disable_warnings
 
1099
drop table if exists t1;
 
1100
--enable_warnings
 
1101
create table t1 (i int);
 
1102
insert into t1 values ();
 
1103
lock table t1 write;
 
1104
# Example of so-called 'fast' ALTER TABLE
 
1105
alter table t1 modify i int default 1;
 
1106
insert into t1 values ();
 
1107
select * from t1;
 
1108
# And now full-blown ALTER TABLE
 
1109
alter table t1 change i c char(10) default "Two";
 
1110
insert into t1 values ();
 
1111
select * from t1;
 
1112
unlock tables;
 
1113
select * from t1;
 
1114
drop tables t1;
 
1115
 
 
1116
#
979
1117
# Bug#29310: An InnoDB table was updated when the data wasn't actually changed.
980
1118
#
981
1119
create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT
983
1121
insert into t1(f1) values(1);
984
1122
--replace_column 1 #
985
1123
select @a:=f2 from t1;
 
1124
--sleep 5
986
1125
update t1 set f1=1;
987
1126
--replace_column 1 #
988
1127
select @b:=f2 from t1;
989
1128
select if(@a=@b,"ok","wrong");
 
1129
--sleep 5
990
1130
insert into t1(f1) values (1) on duplicate key update f1="1";
991
1131
--replace_column 1 #
992
1132
select @b:=f2 from t1;
993
1133
select if(@a=@b,"ok","wrong");
 
1134
--sleep 5
994
1135
insert into t1(f1) select f1 from t1 on duplicate key update f1="1";
995
1136
--replace_column 1 #
996
1137
select @b:=f2 from t1;
1035
1176
#             auto_increment keys
1036
1177
#
1037
1178
create table t1 (a int auto_increment primary key) engine=innodb;
1038
 
--error 1105
1039
1179
alter table t1 order by a;
1040
1180
drop table t1;
1041
1181
 
1096
1236
DROP TABLE t2;
1097
1237
DROP TABLE t1;
1098
1238
 
1099
 
SET GLOBAL innodb_lock_wait_timeout=@orig_lock_wait_timeout ;
1100
 
 
1101
1239
--echo End of 5.1 tests