~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/mix2.inc

  • Committer: Andrew Hutchings
  • Date: 2011-01-28 21:33:48 UTC
  • mto: (2126.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2127.
  • Revision ID: andrew@linuxjedi.co.uk-20110128213348-ypi381xo47o80ypo
Backport fix for http://bugs.mysql.com/bug.php?id=57034

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
update t1 set parent_id=parent_id+100;
97
97
select * from t1 where parent_id=102;
98
98
update t1 set id=id+1000;
99
 
--error ER_DUP_ENTRY,  ER_DUP_KEY
 
99
-- error ER_DUP_ENTRY,1022
100
100
update t1 set id=1024 where id=1009;
101
101
select * from t1;
102
102
update ignore t1 set id=id+1; # This will change all rows
179
179
select n, "after commit" from t1;
180
180
commit;
181
181
insert into t1 values (5);
182
 
--error ER_DUP_ENTRY
 
182
-- error ER_DUP_ENTRY
183
183
insert into t1 values (4);
184
184
commit;
185
185
select n, "after commit" from t1;
186
186
set autocommit=1;
187
187
insert into t1 values (6);
188
 
--error ER_DUP_ENTRY
 
188
-- error ER_DUP_ENTRY
189
189
insert into t1 values (4);
190
190
select n from t1;
191
191
set autocommit=0;
200
200
select n from t1;
201
201
savepoint savept3;
202
202
rollback to savepoint savept2;
203
 
--error ER_SP_DOES_NOT_EXIST
 
203
--error 1305
204
204
rollback to savepoint savept3;
205
205
rollback to savepoint savept2;
206
206
release savepoint `my_savepoint`;
207
207
select n from t1;
208
 
--error ER_SP_DOES_NOT_EXIST
 
208
-- error 1305
209
209
rollback to savepoint `my_savepoint`;
210
 
--error ER_SP_DOES_NOT_EXIST
 
210
--error 1305
211
211
rollback to savepoint savept2;
212
212
insert into t1 values (8);
213
213
savepoint sv;
259
259
 
260
260
eval create $temp table t1 (id char(8) not null primary key, val int not null) engine=$engine_type;
261
261
insert into t1 values ('pippo', 12);
262
 
--error ER_DUP_ENTRY
 
262
-- error ER_DUP_ENTRY
263
263
insert into t1 values ('pippo', 12); # Gives error
264
264
delete from t1;
265
265
delete from t1 where id = 'pippo';
390
390
 
391
391
insert into t1 (ggid,passwd) values ('test1','xxx');
392
392
insert into t1 (ggid,passwd) values ('test2','yyy');
393
 
--error ER_DUP_ENTRY
 
393
-- error ER_DUP_ENTRY
394
394
insert into t1 (ggid,passwd) values ('test2','this will fail');
395
 
--error ER_DUP_ENTRY
 
395
-- error ER_DUP_ENTRY
396
396
insert into t1 (ggid,id) values ('this will fail',1);
397
397
 
398
398
select * from t1 where ggid='test1';
401
401
 
402
402
replace into t1 (ggid,id) values ('this will work',1);
403
403
replace into t1 (ggid,passwd) values ('test2','this will work');
404
 
--error ER_DUP_ENTRY
 
404
-- error ER_DUP_ENTRY
405
405
update t1 set id=100,ggid='test2' where id=1;
406
406
select * from t1;
407
407
select * from t1 where id=1;
625
625
commit;
626
626
drop database mysqltest;
627
627
# Don't check error message
628
 
--error ER_BAD_DB_ERROR
 
628
--error 1049
629
629
show tables from mysqltest;
630
630
 
631
631
#
635
635
set autocommit=0;
636
636
eval create $temp table t1 (a int not null) engine= $engine_type;
637
637
insert into t1 values(1),(2);
638
 
commit;
639
638
truncate table t1;
640
639
commit;
641
640
truncate table t1;
895
894
insert into `t2`values ( 1 ) ;
896
895
eval create $temp table `t3` (`id` int not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = $engine_type;
897
896
insert into `t3`values ( 1 ) ;
898
 
--error ER_ROW_IS_REFERENCED_2
 
897
--error 1451
899
898
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
900
 
--error ER_ROW_IS_REFERENCED_2
 
899
--error 1451
901
900
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
902
 
--error ER_BAD_FIELD_ERROR
 
901
--error 1054
903
902
update t3 set  t3.id=7  where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
904
903
drop table t3,t2,t1;
905
904
 
913
912
        foreign key(pid) references t1(id) on delete cascade) engine=$engine_type;
914
913
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
915
914
        (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
916
 
--error ER_ROW_IS_REFERENCED_2
 
915
-- error 1451
917
916
delete from t1 where id=0;
918
917
delete from t1 where id=15;
919
918
delete from t1 where id=0;
1011
1010
# Bug#2160: Extra error message for create $temp table LIKE with InnoDB
1012
1011
#
1013
1012
eval create $temp table t1 (a int) engine=$engine_type;
1014
 
--error ER_CANT_CREATE_TABLE
 
1013
--error 1005
1015
1014
create table t2 like t1;
1016
1015
create table t2 like t1 engine=innodb;
1017
1016
show create table t2;
1032
1031
create index id2 on t2 (id);
1033
1032
show create table t2;
1034
1033
drop index id2 on t2;
1035
 
--error ER_ERROR_ON_RENAME, ER_ERROR_ON_RENAME
 
1034
--error 1025,1025
1036
1035
drop index id on t2;
1037
1036
show create table t2;
1038
1037
drop table t2;
1071
1070
# Clean up filename -- embedded server reports whole path without .frm,
1072
1071
# regular server reports relative path with .frm (argh!)
1073
1072
--replace_result \\ / $DRIZZLE_TEST_DIR . /var/master-data/ / t2.frm t2
1074
 
--error ER_CANT_CREATE_TABLE
 
1073
--error 1005
1075
1074
eval create $temp table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type;
1076
1075
 
1077
1076
# bug#3749
1124
1123
#
1125
1124
# Bug #6126: Duplicate columns in keys gives misleading error message
1126
1125
#
1127
 
--error ER_DUP_FIELDNAME
 
1126
--error 1060
1128
1127
eval create $temp table t1 (c char(10), index (c,c)) engine=$engine_type;
1129
 
--error ER_DUP_FIELDNAME
 
1128
--error 1060
1130
1129
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=$engine_type;
1131
 
--error ER_DUP_FIELDNAME
 
1130
--error 1060
1132
1131
eval create $temp table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=$engine_type;
1133
 
--error ER_DUP_FIELDNAME
 
1132
--error 1060
1134
1133
eval create $temp table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=$engine_type;
1135
1134
eval create $temp table t1 (c1 char(10), c2 char(10)) engine=$engine_type;
1136
 
--error ER_DUP_FIELDNAME
 
1135
--error 1060
1137
1136
alter table t1 add key (c1,c1);
1138
 
--error ER_DUP_FIELDNAME
 
1137
--error 1060
1139
1138
alter table t1 add key (c2,c1,c1);
1140
 
--error ER_DUP_FIELDNAME
 
1139
--error 1060
1141
1140
alter table t1 add key (c1,c2,c1);
1142
 
--error ER_DUP_FIELDNAME
 
1141
--error 1060
1143
1142
alter table t1 add key (c1,c1,c2);
1144
1143
drop table t1;
1145
1144
 
1160
1159
#
1161
1160
 
1162
1161
eval create $temp table t1 ( a char(10) ) ENGINE=$engine_type;
1163
 
--error ER_TABLE_CANT_HANDLE_FT
 
1162
--error 1214
1164
1163
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
1165
1164
DROP TABLE t1;
1166
1165
}
1229
1228
 
1230
1229
eval create $temp table t1 (x bigint not null primary key) engine=$engine_type;
1231
1230
# The below is out of range for a BIGINT (signed)
1232
 
--error ER_WARN_DATA_OUT_OF_RANGE
 
1231
--error 1264
1233
1232
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
1234
1233
select * from t1;
1235
1234
select count(*) from t1 where x>0;
1435
1434
 id INT PRIMARY KEY
1436
1435
) ENGINE=$engine_type;
1437
1436
 
1438
 
--error ER_CANT_CREATE_TABLE, ER_CANT_CREATE_TABLE
 
1437
--error 1005,1005
1439
1438
eval CREATE TEMPORARY TABLE t2
1440
1439
(
1441
1440
 id INT NOT NULL PRIMARY KEY,
1509
1508
{
1510
1509
 
1511
1510
# these should be refused
1512
 
--error ER_TOO_LONG_KEY
 
1511
--error 1071
1513
1512
eval create $temp table t1 (col1 varchar(768) primary key)
1514
1513
 character set = latin1 engine = $engine_type;
1515
 
--error ER_TOO_LONG_KEY
 
1514
--error 1071
1516
1515
eval create $temp table t2 (col1 varbinary(768) primary key)
1517
1516
 character set = latin1 engine = $engine_type;
1518
 
--error ER_TOO_LONG_KEY
 
1517
--error 1071
1519
1518
eval create $temp table t3 (col1 text, primary key(col1(768)))
1520
1519
 character set = latin1 engine = $engine_type;
1521
 
--error ER_TOO_LONG_KEY
 
1520
--error 1071
1522
1521
eval create $temp table t4 (col1 blob, primary key(col1(768)))
1523
1522
 character set = latin1 engine = $engine_type;
1524
1523
 
1541
1540
 CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
1542
1541
) ENGINE=$engine_type;
1543
1542
 
1544
 
--error ER_NO_REFERENCED_ROW_2
 
1543
--error 1452
1545
1544
INSERT INTO t2 VALUES(2);
1546
1545
 
1547
1546
INSERT INTO t1 VALUES(1);
1548
1547
INSERT INTO t2 VALUES(1);
1549
1548
 
1550
 
--error ER_ROW_IS_REFERENCED_2
 
1549
--error 1451
1551
1550
DELETE FROM t1 WHERE id = 1;
1552
1551
 
1553
 
--error ER_ROW_IS_REFERENCED
 
1552
--error 1217
1554
1553
DROP TABLE t1;
1555
1554
 
1556
1555
SET FOREIGN_KEY_CHECKS=0;
1557
1556
DROP TABLE t1;
1558
1557
SET FOREIGN_KEY_CHECKS=1;
1559
1558
 
1560
 
--error ER_NO_REFERENCED_ROW_2
 
1559
--error 1452
1561
1560
INSERT INTO t2 VALUES(3);
1562
1561
 
1563
1562
DROP TABLE t2;
1573
1572
set foreign_key_checks=0;
1574
1573
eval create $temp table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type;
1575
1574
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1576
 
--error ER_CANT_CREATE_TABLE
 
1575
-- error 1005
1577
1576
eval create $temp table t1(a char(10) primary key, b varchar(20)) engine = $engine_type;
1578
1577
set foreign_key_checks=1;
1579
1578
drop table t2;
1584
1583
set foreign_key_checks=0;
1585
1584
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1;
1586
1585
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1587
 
--error ER_CANT_CREATE_TABLE
 
1586
-- error 1005
1588
1587
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8;
1589
1588
set foreign_key_checks=1;
1590
1589
drop table t1;
1594
1593
set foreign_key_checks=0;
1595
1594
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type;
1596
1595
eval create $temp table t1(a varchar(10) primary key) engine = $engine_type;
1597
 
--error ER_ERROR_ON_RENAME, ER_ERROR_ON_RENAME
 
1596
-- error 1025,1025
1598
1597
alter table t1 modify column a int;
1599
1598
set foreign_key_checks=1;
1600
1599
drop table t2,t1;
1614
1613
eval create $temp table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1;
1615
1614
eval create $temp table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8;
1616
1615
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1617
 
--error ER_ERROR_ON_RENAME
 
1616
-- error 1025
1618
1617
rename table t3 to t1;
1619
1618
set foreign_key_checks=1;
1620
1619
drop table t2,t3;
1628
1627
 
1629
1628
insert into t1 values(1);
1630
1629
insert into t3 values(1);
1631
 
--error ER_NO_REFERENCED_ROW_2
 
1630
-- error 1452
1632
1631
insert into t2 values(2);
1633
 
--error ER_NO_REFERENCED_ROW_2
 
1632
-- error 1452
1634
1633
insert into t4 values(2);
1635
1634
insert into t2 values(1);
1636
1635
insert into t4 values(1);
1637
 
--error ER_ROW_IS_REFERENCED_2
 
1636
-- error 1451
1638
1637
update t1 set a=2;
1639
 
--error ER_NO_REFERENCED_ROW_2
 
1638
-- error 1452
1640
1639
update t2 set a=2;
1641
 
--error ER_ROW_IS_REFERENCED_2
 
1640
-- error 1451
1642
1641
update t3 set a=2;
1643
 
--error ER_NO_REFERENCED_ROW_2
 
1642
-- error 1452
1644
1643
update t4 set a=2;
1645
 
--error ER_ROW_IS_REFERENCED_2
 
1644
-- error 1451
1646
1645
truncate t1;
1647
 
--error ER_ROW_IS_REFERENCED_2
 
1646
-- error 1451
1648
1647
truncate t3;
1649
1648
truncate t2;
1650
1649
truncate t4;
1688
1687
eval create $temp table t4 (s1 char(2),primary key (s1)) engine=$engine_type;
1689
1688
 
1690
1689
insert into t1 values (0x41),(0x4120),(0x4100);
1691
 
--error ER_DUP_ENTRY
 
1690
-- error ER_DUP_ENTRY
1692
1691
insert into t2 values (0x41),(0x4120),(0x4100);
1693
1692
insert into t2 values (0x41),(0x4120);
1694
 
--error ER_DUP_ENTRY
 
1693
-- error ER_DUP_ENTRY
1695
1694
insert into t3 values (0x41),(0x4120),(0x4100);
1696
1695
insert into t3 values (0x41),(0x4100);
1697
 
--error ER_DUP_ENTRY
 
1696
-- error ER_DUP_ENTRY
1698
1697
insert into t4 values (0x41),(0x4120),(0x4100);
1699
1698
insert into t4 values (0x41),(0x4100);
1700
1699
select hex(s1) from t1;
1710
1709
eval create $temp table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type;
1711
1710
 
1712
1711
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
1713
 
--error ER_NO_REFERENCED_ROW_2
 
1712
-- error 1452
1714
1713
insert into t2 values(0x42);
1715
1714
insert into t2 values(0x41);
1716
1715
select hex(s1) from t2;
1717
1716
update t1 set s1=0x123456 where a=2;
1718
1717
select hex(s1) from t2;
1719
 
--error ER_ROW_IS_REFERENCED_2
 
1718
-- error 1451
1720
1719
update t1 set s1=0x12 where a=1;
1721
 
--error ER_ROW_IS_REFERENCED_2
 
1720
-- error 1451
1722
1721
update t1 set s1=0x12345678 where a=1;
1723
 
--error ER_ROW_IS_REFERENCED_2
 
1722
-- error 1451
1724
1723
update t1 set s1=0x123457 where a=1;
1725
1724
update t1 set s1=0x1220 where a=1;
1726
1725
select hex(s1) from t2;
1728
1727
select hex(s1) from t2;
1729
1728
update t1 set s1=0x4200 where a=1;
1730
1729
select hex(s1) from t2;
1731
 
--error ER_ROW_IS_REFERENCED_2
 
1730
-- error 1451
1732
1731
delete from t1 where a=1;
1733
1732
delete from t1 where a=2;
1734
1733
update t2 set s1=0x4120;
1735
 
--error ER_ROW_IS_REFERENCED_2
 
1734
-- error 1451
1736
1735
delete from t1;
1737
1736
delete from t1 where a!=3;
1738
1737
select a,hex(s1) from t1;
1751
1750
update t1 set s1=0x12 where a=2;
1752
1751
select hex(s1) from t2;
1753
1752
delete from t1 where a=1;
1754
 
--error ER_ROW_IS_REFERENCED_2
 
1753
-- error 1451
1755
1754
delete from t1 where a=2;
1756
1755
select a,hex(s1) from t1;
1757
1756
select hex(s1) from t2;
1909
1908
#
1910
1909
# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
1911
1910
#
1912
 
--error ER_XXXLOCK_WAIT_TIMEOUTTTT
 
1911
--error 1205
1913
1912
select * from t1 where a = 2 and b = 2 for update;
1914
1913
#
1915
1914
# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
1916
1915
#
1917
 
--error ER_LOCK_WAIT_TIMEOUT
 
1916
--error 1205
1918
1917
connection a;
1919
1918
commit;
1920
1919
connection b;
2054
2053
create $temp table t10(a int not null, b int, primary key(a)) select * from t2 for update;
2055
2054
 
2056
2055
connection b;
2057
 
--error ER_LOCK_WAIT_TIMEOUT
 
2056
--error 1205
2058
2057
reap;
2059
2058
 
2060
2059
connection c;
2061
 
--error ER_LOCK_WAIT_TIMEOUT
 
2060
--error 1205
2062
2061
reap;
2063
2062
 
2064
2063
connection d;
2065
 
--error ER_LOCK_WAIT_TIMEOUT
 
2064
--error 1205
2066
2065
reap;
2067
2066
 
2068
2067
connection e;
2069
 
--error ER_LOCK_WAIT_TIMEOUT
 
2068
--error 1205
2070
2069
reap;
2071
2070
 
2072
2071
connection f;
2073
 
--error ER_LOCK_WAIT_TIMEOUT
 
2072
--error 1205
2074
2073
reap;
2075
2074
 
2076
2075
connection g;
2077
 
--error ER_LOCK_WAIT_TIMEOUT
 
2076
--error 1205
2078
2077
reap;
2079
2078
 
2080
2079
connection h;
2081
 
--error ER_LOCK_WAIT_TIMEOUT
 
2080
--error 1205
2082
2081
reap;
2083
2082
 
2084
2083
connection i;
2085
 
--error ER_LOCK_WAIT_TIMEOUT
 
2084
--error 1205
2086
2085
reap;
2087
2086
 
2088
2087
connection j;
2089
 
--error ER_LOCK_WAIT_TIMEOUT
 
2088
--error 1205
2090
2089
reap;
2091
2090
 
2092
2091
connection a;
2110
2109
if (test_foreign_keys)
2111
2110
{
2112
2111
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
2113
 
--error ER_CANT_CREATE_TABLE
 
2112
--error 1005
2114
2113
eval create $temp table t1 (DB_ROW_ID int) engine=$engine_type;
2115
2114
 
2116
2115
#