46
46
(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
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,
49
slai_id int not null default '0',
50
owner_tbl int default null,
51
owner_id int default null,
52
sla_id int default null,
53
inc_web int default null,
54
inc_email int default null,
55
inc_chat int default null,
56
inc_csr int default null,
57
inc_total int default null,
58
time_billed int default null,
59
59
activedate timestamp null default null,
60
60
expiredate timestamp null default null,
61
state int(11) default null,
62
sla_set int(11) default null,
61
state int default null,
62
sla_set int default null,
63
63
unique key t2$slai_id (slai_id),
64
64
key t2$owner_id (owner_id),
65
65
key t2$sla_id (sla_id)
487
# Bug #28189: optimizer erroniously prefers ref access to range access
488
# for an InnoDB table
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),
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),
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);
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);
528
SELECT COUNT(*) FROM t1;
529
SELECT COUNT(*) FROM t1 WHERE acct_id=785;
531
EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785;
533
INSERT INTO t2 SELECT * FROM t1;
536
EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
485
# Test needs to be rewritten to not use divide by zero
487
## Bug #28189: optimizer erroniously prefers ref access to range access
488
## for an InnoDB table
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)
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)
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);
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);
528
#SELECT COUNT(*) FROM t1;
529
#SELECT COUNT(*) FROM t1 WHERE acct_id=785;
531
#EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785;
533
#INSERT INTO t2 SELECT * FROM t1;
536
#EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
541
541
# Bug #28652: assert when alter innodb table operation
758
709
--source include/innodb_rollback_on_timeout.inc
761
# Bug#27296 Assertion in ALTER TABLE SET DEFAULT in Linux Debug build
762
# (possible deadlock).
764
# The bug is applicable only to a transactoinal table.
765
# Cover with tests behavior that no longer causes an
769
drop table if exists t1;
771
create table t1 (a int) engine=innodb;
772
alter table t1 alter a set default 1;
776
--echo Bug#24918 drop table and lock / inconsistent between
777
--echo perm and temp tables
779
--echo Check transactional tables under LOCK TABLES
782
drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
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;
791
lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
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;
806
drop table t24918_access;
808
712
# Bug #28591: MySQL need not sort the records in case of ORDER BY
809
713
# primary_key on InnoDB table
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.
1075
drop table if exists t1, t2;
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;
1083
lock table t2 write;
1084
alter table t2 modify i int default 4, rename t1;
1090
# Some more tests for ALTER TABLE and LOCK TABLES for transactional tables.
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
1099
drop table if exists t1;
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 ();
1108
# And now full-blown ALTER TABLE
1109
alter table t1 change i c char(10) default "Two";
1110
insert into t1 values ();
1117
974
# Bug#29310: An InnoDB table was updated when the data wasn't actually changed.
1119
976
create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT