Possibly related to MDEV-24532.
--source include/have_innodb.inc
|
|
CREATE TABLE t1 (a INT, b INT, KEY(a), FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=InnoDB;
|
SET FOREIGN_KEY_CHECKS= OFF;
|
ALTER TABLE t1 MODIFY a SMALLINT;
|
SHOW CREATE TABLE t1;
|
SELECT * FROM information_schema.innodb_sys_foreign;
|
SELECT UNIQUE_CONSTRAINT_NAME, TABLE_NAME, REFERENCED_TABLE_NAME FROM information_schema.referential_constraints;
|
TRUNCATE TABLE t1;
|
|
# Cleanup
|
DROP TABLE t1;
|
In the test case above, 10.2+ versions accept and execute ALTER TABLE, and the column type gets modified. However, after that
- SHOW CREATE TABLE does not show the foreign key any longer;
- information_schema.innodb_sys_foreign still has a record for the foreign key on t1, but information_schema.referential_constraints does not;
- further TRUNCATE TABLE fails with ER_CANNOT_ADD_FOREIGN.
10.5 1b12e251
|
SHOW CREATE TABLE t1;
|
Table Create Table
|
t1 CREATE TABLE `t1` (
|
`a` smallint(6) DEFAULT NULL,
|
`b` int(11) DEFAULT NULL,
|
KEY `a` (`a`),
|
KEY `b` (`b`)
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
SELECT * FROM information_schema.innodb_sys_foreign;
|
ID FOR_NAME REF_NAME N_COLS TYPE
|
test/t1_ibfk_1 test/t1 test/t1 1 0
|
SELECT UNIQUE_CONSTRAINT_NAME, TABLE_NAME, REFERENCED_TABLE_NAME FROM information_schema.referential_constraints;
|
UNIQUE_CONSTRAINT_NAME TABLE_NAME REFERENCED_TABLE_NAME
|
TRUNCATE TABLE t1;
|
bug.trunc4 'innodb' [ fail ]
|
Test ended at 2021-01-09 02:27:46
|
|
CURRENT_TEST: bug.trunc4
|
mysqltest: At line 9: query 'TRUNCATE TABLE t1' failed: 1215: Cannot add foreign key constraint for `t1`
|
Reproducible on 10.2-10.5.
On 10.1 and MySQL 5.7 ALTER TABLE fails with ER_ERROR_ON_RENAME, and no further damage is done.
No workflow transitions have been executed yet.
{"report":{"fcp":1013.8000000119209,"ttfb":299.39999997615814,"pageVisibility":"visible","entityId":95750,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"72144a7d-abf3-4fe4-9665-a1ee8e505a27","navigationType":0,"readyForUser":1101.8999999761581,"redirectCount":0,"resourceLoadedEnd":952.3999999761581,"resourceLoadedStart":305.5,"resourceTiming":[{"duration":156.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":305.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":461.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":156.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":305.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":462,"responseStart":0,"secureConnectionStart":0},{"duration":290.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":305.89999997615814,"connectEnd":305.89999997615814,"connectStart":305.89999997615814,"domainLookupEnd":305.89999997615814,"domainLookupStart":305.89999997615814,"fetchStart":305.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":463.69999998807907,"responseEnd":596.5,"responseStart":562.8999999761581,"secureConnectionStart":305.89999997615814},{"duration":443.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":306.10000002384186,"connectEnd":464.80000001192093,"connectStart":464.80000001192093,"domainLookupEnd":464.80000001192093,"domainLookupStart":464.80000001192093,"fetchStart":306.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":465,"responseEnd":749.8999999761581,"responseStart":479.69999998807907,"secureConnectionStart":464.80000001192093},{"duration":175.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":306.30000001192093,"connectEnd":306.30000001192093,"connectStart":306.30000001192093,"domainLookupEnd":306.30000001192093,"domainLookupStart":306.30000001192093,"fetchStart":306.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":465.39999997615814,"responseEnd":482.19999998807907,"responseStart":477.30000001192093,"secureConnectionStart":306.30000001192093},{"duration":175.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":306.5,"connectEnd":306.5,"connectStart":306.5,"domainLookupEnd":306.5,"domainLookupStart":306.5,"fetchStart":306.5,"redirectEnd":0,"redirectStart":0,"requestStart":466,"responseEnd":482.39999997615814,"responseStart":478.19999998807907,"secureConnectionStart":306.5},{"duration":183.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":306.60000002384186,"connectEnd":306.60000002384186,"connectStart":306.60000002384186,"domainLookupEnd":306.60000002384186,"domainLookupStart":306.60000002384186,"fetchStart":306.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":467.39999997615814,"responseEnd":490.39999997615814,"responseStart":484,"secureConnectionStart":306.60000002384186},{"duration":159.4000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":306.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":306.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":466.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":185.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":307,"connectEnd":307,"connectStart":307,"domainLookupEnd":307,"domainLookupStart":307,"fetchStart":307,"redirectEnd":0,"redirectStart":0,"requestStart":469.89999997615814,"responseEnd":492.10000002384186,"responseStart":485.60000002384186,"secureConnectionStart":307},{"duration":162.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":307.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":307.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":469.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":194.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":307.39999997615814,"connectEnd":307.39999997615814,"connectStart":307.39999997615814,"domainLookupEnd":307.39999997615814,"domainLookupStart":307.39999997615814,"fetchStart":307.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":475.69999998807907,"responseEnd":501.5,"responseStart":492.69999998807907,"secureConnectionStart":307.39999997615814},{"duration":430.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":314.60000002384186,"connectEnd":314.60000002384186,"connectStart":314.60000002384186,"domainLookupEnd":314.60000002384186,"domainLookupStart":314.60000002384186,"fetchStart":314.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":730,"responseEnd":745.3000000119209,"responseStart":743.8999999761581,"secureConnectionStart":314.60000002384186},{"duration":637.5999999642372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":314.80000001192093,"connectEnd":314.80000001192093,"connectStart":314.80000001192093,"domainLookupEnd":314.80000001192093,"domainLookupStart":314.80000001192093,"fetchStart":314.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":941.8000000119209,"responseEnd":952.3999999761581,"responseStart":951.8999999761581,"secureConnectionStart":314.80000001192093},{"duration":221.60000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":723.8999999761581,"connectEnd":723.8999999761581,"connectStart":723.8999999761581,"domainLookupEnd":723.8999999761581,"domainLookupStart":723.8999999761581,"fetchStart":723.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":913,"responseEnd":945.5,"responseStart":944.8000000119209,"secureConnectionStart":723.8999999761581}],"fetchStart":1,"domainLookupStart":106,"domainLookupEnd":114,"connectStart":115,"connectEnd":134,"secureConnectionStart":123,"requestStart":134,"responseStart":300,"responseEnd":314,"domLoading":304,"domInteractive":1174,"domContentLoadedEventStart":1174,"domContentLoadedEventEnd":1221,"domComplete":2546,"loadEventStart":2546,"loadEventEnd":2546,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1157.3999999761581},{"name":"bigPipe.sidebar-id.end","time":1158.300000011921},{"name":"bigPipe.activity-panel-pipe-id.start","time":1158.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.end","time":1158.800000011921},{"name":"activityTabFullyLoaded","time":1233.1000000238419}],"measures":[],"correlationId":"3b3c139d5b76e9","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":97,"dbReadsTimeInMs":15,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}