summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-12-14 14:34:32 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2015-12-14 22:10:37 +0200
commit99404c3437b35b5ee51578c2ea74209ccb9ba890 (patch)
tree7dc58eefe89b0d799589d2ca3d95a452e6e69916 /mysql-test
parent0db50be89349761d5677441f2d60ab52c23947f0 (diff)
downloadmariadb-git-99404c3437b35b5ee51578c2ea74209ccb9ba890.tar.gz
MDEV-9276: MySQL Bug #78754: FK definitions missing from SHOW CREATE TABLE in "innodb_read_only" mode
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/innodb-get-fk.result71
-rw-r--r--mysql-test/suite/innodb/t/innodb-get-fk.test61
2 files changed, 132 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-get-fk.result b/mysql-test/suite/innodb/r/innodb-get-fk.result
new file mode 100644
index 00000000000..0dca82c2d10
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-get-fk.result
@@ -0,0 +1,71 @@
+CREATE SCHEMA `repro`;
+CREATE TABLE `repro`.`crew` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`code` varchar(50) NOT NULL,
+`name` varchar(50) NOT NULL,
+`created_at` timestamp NULL DEFAULT NULL,
+`updated_at` timestamp NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `code` (`code`)
+) ENGINE=InnoDB;
+CREATE TABLE `repro`.`pilot` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`code` varchar(50) NOT NULL,
+`name` varchar(50) NOT NULL,
+`created_at` timestamp NULL DEFAULT NULL,
+`updated_at` timestamp NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `code` (`code`)
+) ENGINE=InnoDB;
+CREATE TABLE `repro`.`crew_role_assigned` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`crew_id` int(11) NOT NULL,
+`role_code` varchar(50) NOT NULL,
+PRIMARY KEY (`id`),
+KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
+CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB COMMENT="This is a comment about tables";
+# Restart mysqld --innodb_read_only_mode=1
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+Table Create Table
+crew_role_assigned CREATE TABLE `crew_role_assigned` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `crew_id` int(11) NOT NULL,
+ `role_code` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
+ KEY `fk_crewRoleAssigned_pilotId` (`crew_id`),
+ CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a comment about tables'
+ALTER TABLE `repro`.`crew_role_assigned` COMMENT = "This is a new comment about tables";
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+Table Create Table
+crew_role_assigned CREATE TABLE `crew_role_assigned` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `crew_id` int(11) NOT NULL,
+ `role_code` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
+ KEY `fk_crewRoleAssigned_pilotId` (`crew_id`),
+ CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a new comment about tables'
+# Restart mysqld --innodb_read_only_mode=1
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+Table Create Table
+crew_role_assigned CREATE TABLE `crew_role_assigned` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `crew_id` int(11) NOT NULL,
+ `role_code` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
+ KEY `fk_crewRoleAssigned_pilotId` (`crew_id`),
+ CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This is a new comment about tables'
+DROP TABLE `repro`.`crew_role_assigned`;
+DROP TABLE `repro`.`pilot`;
+DROP TABLE `repro`.`crew`;
+DROP SCHEMA `repro`;
diff --git a/mysql-test/suite/innodb/t/innodb-get-fk.test b/mysql-test/suite/innodb/t/innodb-get-fk.test
new file mode 100644
index 00000000000..4245bef289f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-get-fk.test
@@ -0,0 +1,61 @@
+-- source include/have_innodb.inc
+# need to restart server
+-- source include/not_embedded.inc
+CREATE SCHEMA `repro`;
+
+CREATE TABLE `repro`.`crew` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`code` varchar(50) NOT NULL,
+`name` varchar(50) NOT NULL,
+`created_at` timestamp NULL DEFAULT NULL,
+`updated_at` timestamp NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `code` (`code`)
+) ENGINE=InnoDB;
+
+CREATE TABLE `repro`.`pilot` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`code` varchar(50) NOT NULL,
+`name` varchar(50) NOT NULL,
+`created_at` timestamp NULL DEFAULT NULL,
+`updated_at` timestamp NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `code` (`code`)
+) ENGINE=InnoDB;
+
+CREATE TABLE `repro`.`crew_role_assigned` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+`crew_id` int(11) NOT NULL,
+`role_code` varchar(50) NOT NULL,
+PRIMARY KEY (`id`),
+KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
+CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB COMMENT="This is a comment about tables";
+
+--echo # Restart mysqld --innodb_read_only_mode=1
+-- let $restart_parameters=--innodb-read-only-mode=1
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+
+-- source include/restart_mysqld.inc
+
+ALTER TABLE `repro`.`crew_role_assigned` COMMENT = "This is a new comment about tables";
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+
+--echo # Restart mysqld --innodb_read_only_mode=1
+-- let $restart_parameters=--innodb-read-only-mode=1
+-- source include/restart_mysqld.inc
+
+#
+# Below create table should contain also fk definitions
+#
+SHOW CREATE TABLE `repro`.`crew_role_assigned`;
+
+-- source include/restart_mysqld.inc
+
+DROP TABLE `repro`.`crew_role_assigned`;
+DROP TABLE `repro`.`pilot`;
+DROP TABLE `repro`.`crew`;
+DROP SCHEMA `repro`;