~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/t/lowercase_table4.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--source include/have_case_insensitive_file_system.inc
 
2
--source include/have_innodb.inc
 
3
 
 
4
--echo #
 
5
--echo # Bug#46941 crash with lower_case_table_names=2 and
 
6
--echo #           foreign data dictionary confusion
 
7
--echo #
 
8
 
 
9
CREATE DATABASE XY;
 
10
USE XY;
 
11
 
 
12
#
 
13
# Logs are disabled, since the number of creates tables
 
14
# and subsequent select statements may vary between
 
15
# versions
 
16
#
 
17
--disable_query_log
 
18
--disable_result_log
 
19
 
 
20
let $tcs = `SELECT @@table_open_cache + 1`;
 
21
 
 
22
let $i = $tcs;
 
23
 
 
24
while ($i)
 
25
{
 
26
  eval CREATE TABLE XY.T_$i (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, 
 
27
                             primary key(a, b), unique(b)) ENGINE=InnoDB;
 
28
  dec $i;
 
29
}
 
30
 
 
31
eval ALTER TABLE XY.T_$tcs ADD INDEX I1 (c, b), 
 
32
                           ADD CONSTRAINT C1 FOREIGN KEY (c, b) REFERENCES XY.T_1 (a, b);
 
33
                   
 
34
eval ALTER TABLE XY.T_$tcs ADD INDEX I2 (b),
 
35
                           ADD CONSTRAINT C2 FOREIGN KEY (b) REFERENCES XY.T_1(a);
 
36
 
 
37
let $i = $tcs;
 
38
while ($i)
 
39
{
 
40
  eval SELECT * FROM XY.T_$i LIMIT 1;
 
41
  dec $i;
 
42
}
 
43
 
 
44
DROP DATABASE XY;
 
45
CREATE DATABASE XY;
 
46
USE XY;
 
47
eval CREATE TABLE XY.T_$tcs (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, 
 
48
                             PRIMARY KEY(a, b), UNIQUE(b)) ENGINE=InnoDB;
 
49
#
 
50
# The bug causes this SELECT to err
 
51
eval SELECT * FROM XY.T_$tcs LIMIT 1;
 
52
 
 
53
--enable_query_log
 
54
--enable_result_log
 
55
DROP DATABASE XY;
 
56
USE TEST;
 
57
 
 
58
--echo #
 
59
--echo # Bug55222 Mysqldump table names case bug in REFERENCES clause
 
60
--echo # InnoDB did not handle lower_case_table_names=2 for
 
61
--echo # foreign_table_names and referenced_table_names.
 
62
--echo #
 
63
 
 
64
SHOW VARIABLES LIKE 'lower_case_table_names';
 
65
 
 
66
--disable_warnings
 
67
DROP TABLE IF EXISTS `Table2`;
 
68
DROP TABLE IF EXISTS `Table1`;
 
69
--disable_warnings
 
70
 
 
71
CREATE TABLE `Table1`(c1 INT PRIMARY KEY) ENGINE=InnoDB;
 
72
CREATE TABLE `Table2`(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
 
73
ALTER TABLE `Table2` ADD CONSTRAINT fk1 FOREIGN KEY(c2) REFERENCES `Table1`(c1);
 
74
query_vertical SHOW CREATE TABLE `Table2`;
 
75
query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
 
76
DROP TABLE `Table2`;
 
77
DROP TABLE `Table1`;
 
78
 
 
79
--disable_warnings
 
80
DROP TABLE IF EXISTS Product_Order;
 
81
DROP TABLE IF EXISTS Product;
 
82
DROP TABLE IF EXISTS Customer;
 
83
--enable_warnings
 
84
 
 
85
CREATE TABLE Product (Category INT NOT NULL, Id INT NOT NULL,
 
86
        Price DECIMAL, PRIMARY KEY(Category, Id)) ENGINE=InnoDB;
 
87
CREATE TABLE Customer (Id INT NOT NULL, PRIMARY KEY (Id)) ENGINE=InnoDB;
 
88
CREATE TABLE Product_Order (No INT NOT NULL AUTO_INCREMENT,
 
89
        Product_Category INT NOT NULL,
 
90
        Product_Id INT NOT NULL,
 
91
        Customer_Id INT NOT NULL,
 
92
        PRIMARY KEY(No),
 
93
        INDEX (Product_Category, Product_Id),
 
94
        FOREIGN KEY (Product_Category, Product_Id)
 
95
                REFERENCES Product(Category, Id) ON UPDATE CASCADE ON DELETE RESTRICT,
 
96
        INDEX (Customer_Id),
 
97
        FOREIGN KEY (Customer_Id)
 
98
                REFERENCES Customer(Id)
 
99
        ) ENGINE=INNODB;
 
100
 
 
101
query_vertical SHOW CREATE TABLE Product_Order;
 
102
query_vertical SHOW CREATE TABLE Product;
 
103
query_vertical SHOW CREATE TABLE Customer;
 
104
query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
 
105
DROP TABLE Product_Order;
 
106
DROP TABLE Product;
 
107
DROP TABLE Customer;
 
108