~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/innodb_mysql.result

  • Committer: Monty Taylor
  • Date: 2009-03-04 02:16:28 UTC
  • mto: (917.1.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: mordred@inaugust.com-20090304021628-rfq0b16uoi09g8tx
Fix to make VPATH builds work again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
set session innodb_support_xa=default;
3
3
SET SESSION STORAGE_ENGINE = InnoDB;
4
4
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
5
 
drop procedure if exists p1;
6
5
create table t1 (
7
 
c_id int(11) not null default '0',
8
 
org_id int(11) default null,
 
6
c_id int not null default '0',
 
7
org_id int default null,
9
8
unique key contacts$c_id (c_id),
10
9
key contacts$org_id (org_id)
11
10
);
14
13
(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
15
14
(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
16
15
create table t2 (
17
 
slai_id int(11) not null default '0',
18
 
owner_tbl int(11) default null,
19
 
owner_id int(11) default null,
20
 
sla_id int(11) default null,
21
 
inc_web int(11) default null,
22
 
inc_email int(11) default null,
23
 
inc_chat int(11) default null,
24
 
inc_csr int(11) default null,
25
 
inc_total int(11) default null,
26
 
time_billed int(11) default null,
 
16
slai_id int not null default '0',
 
17
owner_tbl int default null,
 
18
owner_id int default null,
 
19
sla_id int default null,
 
20
inc_web int default null,
 
21
inc_email int default null,
 
22
inc_chat int default null,
 
23
inc_csr int default null,
 
24
inc_total int default null,
 
25
time_billed int default null,
27
26
activedate timestamp null default null,
28
27
expiredate timestamp null default null,
29
 
state int(11) default null,
30
 
sla_set int(11) default null,
 
28
state int default null,
 
29
sla_set int default null,
31
30
unique key t2$slai_id (slai_id),
32
31
key t2$owner_id (owner_id),
33
32
key t2$sla_id (sla_id)
71
70
INSERT INTO t3 VALUES (1,1,1),(2,1,2);
72
71
INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
73
72
INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
74
 
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
 
73
SELECT STRAIGHT_JOIN t1.b, t1.a FROM t1, t3, t2 WHERE
75
74
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
76
75
ORDER BY t1.b LIMIT 2;
77
76
b       a
78
77
1       1
79
78
2       2
80
 
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
 
79
SELECT STRAIGHT_JOIN t1.b, t1.a FROM t1, t3, t2 WHERE
81
80
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
82
81
ORDER BY t1.b LIMIT 5;
83
82
b       a
108
107
id1
109
108
2
110
109
DROP TABLE t1, t2;
111
 
create table t1 (c1 int) engine=innodb;
112
 
handler t1 open;
113
 
handler t1 read first;
114
 
c1
115
 
Before and after comparison
116
 
0
117
 
drop table t1;
118
110
CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1)
119
 
ENGINE=INNODB CHARACTER SET UTF8;
 
111
ENGINE=INNODB;
120
112
INSERT INTO t1 (c1) VALUES ('1a');
121
113
SELECT * FROM t1;
122
114
c1      cnt
127
119
1a      2
128
120
DROP TABLE t1;
129
121
CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
130
 
ENGINE=INNODB CHARACTER SET UTF8;
 
122
ENGINE=INNODB;
131
123
INSERT INTO t1 (c1) VALUES ('1a');
132
124
SELECT * FROM t1;
133
125
c1      cnt
138
130
1a      2
139
131
DROP TABLE t1;
140
132
CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
141
 
ENGINE=INNODB CHARACTER SET UTF8;
 
133
ENGINE=INNODB;
142
134
INSERT INTO t1 (c1) VALUES ('1a');
143
135
SELECT * FROM t1;
144
136
c1      cnt
151
143
CREATE TABLE t1 (
152
144
a1 decimal(10,0) DEFAULT NULL,
153
145
a2 blob,
154
 
a3 time DEFAULT NULL,
155
146
a4 blob,
156
147
a5 char(175) DEFAULT NULL,
157
148
a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
158
 
a7 tinyblob,
 
149
a7 blob,
159
150
INDEX idx (a6,a7(239),a5)
160
151
) ENGINE=InnoDB;
161
152
EXPLAIN SELECT a4 FROM t1 WHERE
175
166
create table t2i (a int);
176
167
insert into t2m values (5);
177
168
insert into t2i values (5);
178
 
select min(a) from t1i;
179
 
min(a)
180
 
NULL
181
 
select min(7) from t1i;
182
 
min(7)
183
 
NULL
184
 
select min(7) from DUAL;
185
 
min(7)
186
 
7
187
 
explain select min(7) from t2i join t1i;
188
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
189
 
1       SIMPLE  t2i     ALL     NULL    NULL    NULL    NULL    1       
190
 
1       SIMPLE  t1i     ALL     NULL    NULL    NULL    NULL    1       Using join buffer
191
 
select min(7) from t2i join t1i;
192
 
min(7)
193
 
NULL
194
 
select max(a) from t1i;
195
 
max(a)
196
 
NULL
197
 
select max(7) from t1i;
198
 
max(7)
199
 
NULL
200
 
select max(7) from DUAL;
201
 
max(7)
202
 
7
203
 
explain select max(7) from t2i join t1i;
204
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
205
 
1       SIMPLE  t2i     ALL     NULL    NULL    NULL    NULL    1       
206
 
1       SIMPLE  t1i     ALL     NULL    NULL    NULL    NULL    1       Using join buffer
207
 
select max(7) from t2i join t1i;
208
 
max(7)
209
 
NULL
210
169
select 1, min(a) from t1i where a=99;
211
170
1       min(a)
212
171
1       NULL
340
299
alter table t1 drop primary key, add primary key (f2, f1);
341
300
explain select distinct f1 a, f1 b from t1;
342
301
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
343
 
1       SIMPLE  t1      index   NULL    PRIMARY 5       NULL    4       Using index; Using temporary
 
302
1       SIMPLE  t1      index   NULL    PRIMARY 10      NULL    4       Using index; Using temporary
344
303
explain select distinct f1, f2 from t1;
345
304
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
346
 
1       SIMPLE  t1      range   NULL    PRIMARY 5       NULL    3       Using index for group-by; Using temporary
 
305
1       SIMPLE  t1      range   NULL    PRIMARY 10      NULL    3       Using index for group-by; Using temporary
347
306
drop table t1;
348
 
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
 
307
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, name varchar(20),
349
308
INDEX (name));
350
 
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11));
 
309
CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, fkey int);
351
310
ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id);
352
311
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
353
312
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
368
327
id int NOT NULL,
369
328
name varchar(20) NOT NULL,
370
329
dept varchar(20) NOT NULL,
371
 
age tinyint(3) unsigned NOT NULL,
 
330
age int NOT NULL,
372
331
PRIMARY KEY (id),
373
332
INDEX (name,dept)
374
333
) ENGINE=InnoDB;
379
338
(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
380
339
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
381
340
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
382
 
1       SIMPLE  t1      range   name    name    44      NULL    2       Using where; Using index for group-by
 
341
1       SIMPLE  t1      range   name    name    164     NULL    2       Using where; Using index for group-by
383
342
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
384
343
name    dept
385
344
rs5     cs10
387
346
DELETE FROM t1;
388
347
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
389
348
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
390
 
1       SIMPLE  t1      range   name    name    44      NULL    2       Using where; Using index for group-by
 
349
1       SIMPLE  t1      range   name    name    164     NULL    2       Using where; Using index for group-by
391
350
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
392
351
name    dept
393
352
DROP TABLE t1;
395
354
show variables like 'innodb_rollback_on_timeout';
396
355
Variable_name   Value
397
356
innodb_rollback_on_timeout      OFF
398
 
create table t1 (a int unsigned not null primary key) engine = innodb;
 
357
create table t1 (a int not null primary key) engine = innodb;
399
358
insert into t1 values (1);
400
359
commit;
401
360
begin work;
428
387
2
429
388
5
430
389
drop table t1;
431
 
set @save_qcache_size=@@global.query_cache_size;
432
 
set @save_qcache_type=@@global.query_cache_type;
433
 
set global query_cache_size=10*1024*1024;
434
 
set global query_cache_type=1;
435
390
drop table if exists `test`;
436
391
Warnings:
437
392
Note    1051    Unknown table 'test'
438
393
CREATE TABLE `test` (`test1` varchar(3) NOT NULL,
439
394
`test2` varchar(4) NOT NULL,PRIMARY KEY  (`test1`))
440
 
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
395
ENGINE=InnoDB;
441
396
INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '5678');
442
397
select * from test;
443
398
test1   test2
452
407
test1   test2
453
408
tes     1234
454
409
drop table test;
455
 
set global query_cache_type=@save_qcache_type;
456
 
set global query_cache_size=@save_qcache_size;
457
410
drop table if exists t1;
458
411
show variables like 'innodb_rollback_on_timeout';
459
412
Variable_name   Value
460
413
innodb_rollback_on_timeout      OFF
461
 
create table t1 (a int unsigned not null primary key) engine = innodb;
 
414
create table t1 (a int not null primary key) engine = innodb;
462
415
insert into t1 values (1);
463
416
commit;
464
417
begin work;
530
483
3       b       2
531
484
4       a       2
532
485
drop table t1;
533
 
CREATE TABLE t1(
534
 
id int AUTO_INCREMENT PRIMARY KEY,
535
 
stat_id int NOT NULL,
536
 
acct_id int DEFAULT NULL,
537
 
INDEX idx1 (stat_id, acct_id),
538
 
INDEX idx2 (acct_id)
539
 
) ENGINE=MyISAM;
540
 
CREATE TABLE t2(
541
 
id int AUTO_INCREMENT PRIMARY KEY,
542
 
stat_id int NOT NULL,
543
 
acct_id int DEFAULT NULL,
544
 
INDEX idx1 (stat_id, acct_id),
545
 
INDEX idx2 (acct_id)
546
 
) ENGINE=InnoDB;
547
 
INSERT INTO t1(stat_id,acct_id) VALUES
548
 
(1,759), (2,831), (3,785), (4,854), (1,921),
549
 
(1,553), (2,589), (3,743), (2,827), (2,545),
550
 
(4,779), (4,783), (1,597), (1,785), (4,832),
551
 
(1,741), (1,833), (3,788), (2,973), (1,907);
552
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
553
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
554
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
555
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
556
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
557
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
558
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
559
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
560
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
561
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
562
 
INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
563
 
UPDATE t1 SET acct_id=785 
564
 
WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id);
565
 
OPTIMIZE TABLE t1;
566
 
Table   Op      Msg_type        Msg_text
567
 
test.t1 optimize        status  OK
568
 
SELECT COUNT(*) FROM t1;
569
 
COUNT(*)
570
 
40960
571
 
SELECT COUNT(*) FROM t1 WHERE acct_id=785;
572
 
COUNT(*)
573
 
8702
574
 
EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785;
575
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
576
 
1       SIMPLE  t1      range   idx1,idx2       idx1    9       NULL    2       Using where; Using index
577
 
INSERT INTO t2 SELECT * FROM t1;
578
 
OPTIMIZE TABLE t2;
579
 
Table   Op      Msg_type        Msg_text
580
 
test.t2 optimize        status  OK
581
 
EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
582
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
583
 
1       SIMPLE  t2      range   idx1,idx2       idx1    9       NULL    2       Using where; Using index
584
 
DROP TABLE t1,t2;
585
486
create table t1(a int) engine=innodb;
586
487
alter table t1 comment '123';
587
488
show create table t1;
588
489
Table   Create Table
589
490
t1      CREATE TABLE `t1` (
590
 
  `a` int(11) DEFAULT NULL
591
 
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123'
 
491
  `a` int DEFAULT NULL
 
492
) ENGINE=InnoDB COMMENT='123'
592
493
drop table t1;
593
 
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
 
494
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
594
495
INSERT INTO t1 VALUES ('uk'),('bg');
595
496
SELECT * FROM t1 WHERE a = 'uk';
596
497
a
626
527
SELECT * FROM t3 WHERE a = 'uk';
627
528
a
628
529
DROP TABLE t1,t2,t3;
629
 
create table t1 (a int) engine=innodb;
630
 
select * from bug29807;
631
 
ERROR 42S02: Table 'test.bug29807' doesn't exist
632
 
drop table t1;
633
 
drop table bug29807;
634
 
ERROR 42S02: Unknown table 'bug29807'
635
 
create table bug29807 (a int);
636
 
drop table bug29807;
637
530
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
638
531
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
639
532
switch to connection c1
759
652
SELECT * from t2;
760
653
a       b
761
654
drop table t1,t2;
762
 
create table t1(f1 varchar(800) binary not null, key(f1))
763
 
character set utf8 collate utf8_general_ci;
 
655
create table t1(f1 varchar(800) not null, key(f1));
764
656
Warnings:
765
657
Warning 1071    Specified key was too long; max key length is 767 bytes
766
658
insert into t1 values('aaa');
785
677
show variables like 'innodb_rollback_on_timeout';
786
678
Variable_name   Value
787
679
innodb_rollback_on_timeout      OFF
788
 
create table t1 (a int unsigned not null primary key) engine = innodb;
 
680
create table t1 (a int not null primary key) engine = innodb;
789
681
insert into t1 values (1);
790
682
commit;
791
683
begin work;
1095
987
15      1       1
1096
988
16      1       1
1097
989
DROP TABLE t1,t2;
1098
 
CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
1099
 
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
1100
 
INSERT INTO t1 SELECT a + 8  FROM t1;
1101
 
INSERT INTO t1 SELECT a + 16 FROM t1;
1102
 
CREATE PROCEDURE p1 ()
1103
 
BEGIN
1104
 
DECLARE i INT DEFAULT 50;
1105
 
DECLARE cnt INT;
1106
 
START TRANSACTION;
1107
 
ALTER TABLE t1 ENGINE=InnoDB;
1108
 
COMMIT;
1109
 
START TRANSACTION;
1110
 
WHILE (i > 0) DO
1111
 
SET i = i - 1;
1112
 
SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
1113
 
END WHILE;
1114
 
COMMIT;
1115
 
END;|
1116
 
CALL p1();
1117
 
CALL p1();
1118
 
CALL p1();
1119
 
DROP PROCEDURE p1;
1120
 
DROP TABLE t1;
1121
 
create table t1(a text) engine=innodb default charset=utf8;
 
990
create table t1(a text) engine=innodb;
1122
991
insert into t1 values('aaa');
1123
992
alter table t1 add index(a(1024));
1124
993
Warnings:
1129
998
Table   Create Table
1130
999
t1      CREATE TABLE `t1` (
1131
1000
  `a` text,
1132
 
  KEY `a` (`a`(191))
1133
 
) ENGINE=InnoDB DEFAULT CHARSET=utf8
 
1001
  KEY `a` (`a`())
 
1002
) ENGINE=InnoDB
1134
1003
drop table t1;
1135
1004
CREATE TABLE t1 (
1136
1005
a INT,
1334
1203
b char(4) not null, unique key bb(b(4))) engine=innodb;
1335
1204
desc t1;
1336
1205
Field   Type    Null    Key     Default Extra
1337
 
a       char(10)        NO      UNI     NULL    
1338
 
b       char(4) NO      PRI     NULL    
 
1206
a       varchar(10)     NO      UNI     NULL    
 
1207
b       varchar(4)      NO      PRI     NULL    
1339
1208
show create table t1;
1340
1209
Table   Create Table
1341
1210
t1      CREATE TABLE `t1` (
1342
 
  `a` char(10) NOT NULL,
1343
 
  `b` char(4) NOT NULL,
 
1211
  `a` varchar(10) NOT NULL,
 
1212
  `b` varchar(4) NOT NULL,
1344
1213
  UNIQUE KEY `bb` (`b`),
1345
 
  UNIQUE KEY `aa` (`a`(1))
1346
 
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
1214
  UNIQUE KEY `aa` (`a`())
 
1215
) ENGINE=InnoDB
1347
1216
drop table t1;
1348
1217
CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
1349
1218
INSERT INTO t1 VALUES 
1365
1234
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
1366
1235
End of 5.0 tests
1367
1236
CREATE TABLE `t2` (
1368
 
`k` int(11) NOT NULL auto_increment,
1369
 
`a` int(11) default NULL,
1370
 
`c` int(11) default NULL,
 
1237
`k` int NOT NULL auto_increment,
 
1238
`a` int default NULL,
 
1239
`c` int default NULL,
1371
1240
PRIMARY KEY  (`k`),
1372
1241
UNIQUE KEY `idx_1` (`a`)
1373
1242
);
1471
1340
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
1472
1341
insert into t1(f1) values(1);
1473
1342
select @a:=f2 from t1;
1474
 
@a:=f2
 
1343
@a:=f2 
1475
1344
#
1476
1345
update t1 set f1=1;
1477
1346
select @b:=f2 from t1;
1478
 
@b:=f2
 
1347
@b:=f2 
1479
1348
#
1480
1349
select if(@a=@b,"ok","wrong");
1481
1350
if(@a=@b,"ok","wrong")
1482
1351
ok
1483
1352
insert into t1(f1) values (1) on duplicate key update f1="1";
1484
1353
select @b:=f2 from t1;
1485
 
@b:=f2
 
1354
@b:=f2 
1486
1355
#
1487
1356
select if(@a=@b,"ok","wrong");
1488
1357
if(@a=@b,"ok","wrong")
1489
1358
ok
1490
1359
insert into t1(f1) select f1 from t1 on duplicate key update f1="1";
1491
1360
select @b:=f2 from t1;
1492
 
@b:=f2
 
1361
@b:=f2 
1493
1362
#
1494
1363
select if(@a=@b,"ok","wrong");
1495
1364
if(@a=@b,"ok","wrong")
1496
1365
ok
1497
1366
drop table t1;
1498
 
SET SESSION AUTOCOMMIT = 0;
1499
 
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
1500
 
# Switch to connection con1
1501
 
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
1502
 
ENGINE = InnoDB;
1503
 
INSERT INTO t1 VALUES (1,2);
1504
 
# 1. test for locking:
1505
 
BEGIN;
1506
 
UPDATE t1 SET b = 12 WHERE a = 1;
1507
 
affected rows: 1
1508
 
info: Rows matched: 1  Changed: 1  Warnings: 0
1509
 
SELECT * FROM t1;
1510
 
a       b
1511
 
1       12
1512
 
# Switch to connection con2
1513
 
UPDATE t1 SET b = 21 WHERE a = 1;
1514
 
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1515
 
# Switch to connection con1
1516
 
SELECT * FROM t1;
1517
 
a       b
1518
 
1       12
1519
 
ROLLBACK;
1520
 
# 2. test for serialized update:
1521
 
CREATE TABLE t2 (a INT);
1522
 
TRUNCATE t1;
1523
 
INSERT INTO t1 VALUES (1,'init');
1524
 
CREATE PROCEDURE p1()
1525
 
BEGIN
1526
 
UPDATE t1 SET b = CONCAT(b, '+con2')  WHERE a = 1;
1527
 
INSERT INTO t2 VALUES ();
1528
 
END|
1529
 
BEGIN;
1530
 
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
1531
 
affected rows: 1
1532
 
info: Rows matched: 1  Changed: 1  Warnings: 0
1533
 
SELECT * FROM t1;
1534
 
a       b
1535
 
1       init+con1
1536
 
# Switch to connection con2
1537
 
CALL p1;;
1538
 
# Switch to connection con1
1539
 
SELECT * FROM t1;
1540
 
a       b
1541
 
1       init+con1
1542
 
COMMIT;
1543
 
SELECT * FROM t1;
1544
 
a       b
1545
 
1       init+con1
1546
 
# Switch to connection con2
1547
 
SELECT * FROM t1;
1548
 
a       b
1549
 
1       init+con1+con2
1550
 
# Switch to connection con1
1551
 
# 3. test for updated key column:
1552
 
TRUNCATE t1;
1553
 
TRUNCATE t2;
1554
 
INSERT INTO t1 VALUES (1,'init');
1555
 
BEGIN;
1556
 
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
1557
 
affected rows: 1
1558
 
info: Rows matched: 1  Changed: 1  Warnings: 0
1559
 
SELECT * FROM t1;
1560
 
a       b
1561
 
2       init+con1
1562
 
# Switch to connection con2
1563
 
CALL p1;;
1564
 
# Switch to connection con1
1565
 
SELECT * FROM t1;
1566
 
a       b
1567
 
2       init+con1
1568
 
COMMIT;
1569
 
SELECT * FROM t1;
1570
 
a       b
1571
 
2       init+con1
1572
 
# Switch to connection con2
1573
 
SELECT * FROM t1;
1574
 
a       b
1575
 
2       init+con1
1576
 
DROP PROCEDURE p1;
1577
 
DROP TABLE t1, t2;
1578
1367
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb;
1579
1368
CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
1580
1369
CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
1601
1390
SHOW CREATE TABLE t2;
1602
1391
Table   Create Table
1603
1392
t2      CREATE TABLE `t2` (
1604
 
  `c` int(11) NOT NULL,
1605
 
  `d` int(11) NOT NULL,
 
1393
  `c` int NOT NULL,
 
1394
  `d` int NOT NULL,
1606
1395
  PRIMARY KEY (`c`,`d`),
1607
1396
  CONSTRAINT `c1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON DELETE NO ACTION,
1608
1397
  CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
1609
1398
  CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
1610
1399
  CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION
1611
 
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
1400
) ENGINE=InnoDB
1612
1401
DROP TABLE t2;
1613
1402
DROP TABLE t1;
1614
1403
create table t1 (a int auto_increment primary key) engine=innodb;
1615
1404
alter table t1 order by a;
1616
 
Warnings:
1617
 
Warning 1105    ORDER BY ignored as there is a user-defined clustered index in the table 't1'
 
1405
ERROR HY000: order_st BY ignored because there is a user-defined clustered index in the table 't1'
1618
1406
drop table t1;
1619
1407
CREATE TABLE t1
1620
1408
(vid integer NOT NULL,