Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.1.13
-
10.1.15
Description
The below test case shows that you can create an ibd file without an frm file using sql and foreign keys:
drop database if exists bug_fk; |
create database bug_fk; |
use bug_fk; |
CREATE TABLE b ( |
b int unsigned NOT NULL, |
d1 datetime NOT NULL, |
PRIMARY KEY (b,d1) |
) ENGINE=InnoDB;
|
|
CREATE TABLE c ( |
b int unsigned NOT NULL, |
d1 datetime NOT NULL, |
d2 datetime NOT NULL, |
PRIMARY KEY (b,d1), |
CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) |
) ENGINE=InnoDB;
|
set foreign_key_checks = 0; |
DROP TABLE IF EXISTS b; |
CREATE TABLE b ( |
b bigint unsigned NOT NULL, |
d1 date NOT NULL, |
PRIMARY KEY (b,d1) |
) ENGINE=InnoDB;
|
|
DROP TABLE IF EXISTS d; |
|
CREATE TABLE d ( |
b bigint unsigned NOT NULL, |
d1 date NOT NULL, |
PRIMARY KEY (b,d1), |
CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) |
) ENGINE=InnoDB;
|
|
set foreign_key_checks = 1; |
CREATE TABLE b ( |
b bigint unsigned NOT NULL, |
d1 date NOT NULL, |
PRIMARY KEY (b,d1) |
) ENGINE=InnoDB;
|
set foreign_key_checks=0; |
drop table c; |
drop table d; |
create table b(id int); |
Check https://bugs.mysql.com/bug.php?id=81444 and https://bugs.launchpad.net/percona-server/+bug/1582501 for more details (note that -f flag is NOT needed in case of mysql client from MariaDB, as it continues to execute statements in case of SQL error by default).
Attachments
Issue Links
Activity
Field | Original Value | New Value |
---|---|---|
Labels | upstream |
Description |
The below test case shows that you can create an ibd file without an frm file using sql and foreign keys:
{noformat} drop database if exists bug_fk; create database bug_fk; use bug_fk; CREATE TABLE b ( b int unsigned NOT NULL, d1 datetime NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; CREATE TABLE c ( b int unsigned NOT NULL, d1 datetime NOT NULL, d2 datetime NOT NULL, PRIMARY KEY (b,d1), CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) ) ENGINE=InnoDB; set foreign_key_checks = 0; DROP TABLE IF EXISTS b; CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; DROP TABLE IF EXISTS d; CREATE TABLE d ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1), CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) ) ENGINE=InnoDB; set foreign_key_checks = 1; CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; set foreign_key_checks=0; drop table c; drop table d; create table b(id int); {noformat} Check https://bugs.mysql.com/bug.php?id=81444 and https://bugs.launchpad.net/percona-server/+bug/1582501 for more details (note that -f flag is NOT needed in case of mysql client from MariaDB, as it continues to execute statements in case of SQL error by default). |
The below test case shows that you can create an ibd file without an frm file using sql and foreign keys:
{code:sql} drop database if exists bug_fk; create database bug_fk; use bug_fk; CREATE TABLE b ( b int unsigned NOT NULL, d1 datetime NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; CREATE TABLE c ( b int unsigned NOT NULL, d1 datetime NOT NULL, d2 datetime NOT NULL, PRIMARY KEY (b,d1), CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) ) ENGINE=InnoDB; set foreign_key_checks = 0; DROP TABLE IF EXISTS b; CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; DROP TABLE IF EXISTS d; CREATE TABLE d ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1), CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) ) ENGINE=InnoDB; set foreign_key_checks = 1; CREATE TABLE b ( b bigint unsigned NOT NULL, d1 date NOT NULL, PRIMARY KEY (b,d1) ) ENGINE=InnoDB; set foreign_key_checks=0; drop table c; drop table d; create table b(id int); {code} Check https://bugs.mysql.com/bug.php?id=81444 and https://bugs.launchpad.net/percona-server/+bug/1582501 for more details (note that -f flag is NOT needed in case of mysql client from MariaDB, as it continues to execute statements in case of SQL error by default). |
Remote Link | This issue links to "Bug #81444 Orphan ibd file when playing with foreign keys (Web Link)" [ 27343 ] |
Remote Link | This issue links to "Bug #1582501 “Orphan .ibd files when playing with foreign keys” (Web Link)" [ 27344 ] |
Assignee | Jan Lindström [ jplindst ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Fix Version/s | 10.1 [ 16100 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Sprint | 10.1.15 [ 75 ] |
Fix Version/s | 5.5 [ 15800 ] |
Fix Version/s | 10.0 [ 16000 ] |
issue.field.resolutiondate | 2016-06-23 04:59:37.0 | 2016-06-23 04:59:37.966 |
Fix Version/s | 5.5.51 [ 22015 ] | |
Fix Version/s | 10.0.26 [ 22016 ] | |
Fix Version/s | 10.1.15 [ 22018 ] | |
Fix Version/s | 5.5 [ 15800 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 75701 ] | MariaDB v4 [ 150436 ] |