Then try to drop the constraint and the t2_id column from table t1, but accidentally give two "drop t2_id" clauses.
altertable t1 dropconstraint t1_fk_t2_id, drop t2_id, drop t2_id;
ERROR 1091 (42000): Can't DROPCOLUMN `t1_fk_t2_id`; check that it exists
This not a sensible or correct error message. I would have expected the error message to refer to column t2_id rather than a non-existing column with an identical name to the constraint we're trying to drop.
I tested this on MariaDB Server 10.8.3 (with a newer mariadb client), but suspect it's present in newer versions as well.
It looks like this issue exists since the creation of MariaDB Server 10.0 when some code was imported from MySQL 5.6. Both in MySQL and MariaDB, InnoDB specific error messages were discouraged, so I had used the closest applicable one, ER_CANT_DROP_FIELD_OR_KEY, in WL#5545 Implement simple in-place ALTER TABLE operations: DROP_FOREIGN_KEY (MySQL 5.6.6).
Marko Mäkelä
added a comment - It looks like this issue exists since the creation of MariaDB Server 10.0 when some code was imported from MySQL 5.6. Both in MySQL and MariaDB, InnoDB specific error messages were discouraged, so I had used the closest applicable one, ER_CANT_DROP_FIELD_OR_KEY , in WL#5545 Implement simple in-place ALTER TABLE operations: DROP_FOREIGN_KEY (MySQL 5.6.6).
where, as you can see, the word "COLUMN" comes from some element in the middle of the list drop->type_name(), but the name comes from the first element in the drop list, thus the mismatch. The correct message should've been
ERROR 1091 (42000): Can't DROP COLUMN `t2_id`; check that it exists
Sergei Golubchik
added a comment - - edited marko , the bug was that it says "COLUMN" and used FK name. Because of
sql/sql_table.cc
8755
while ((drop=drop_it++)) {
8756
switch (drop->type) {
8757
case Alter_drop::KEY:
8758
case Alter_drop::COLUMN:
8759
case Alter_drop::CHECK_CONSTRAINT:
8760
case Alter_drop::PERIOD:
8761
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop->type_name(),
8762
alter_info->drop_list.head()->name);
8763
goto err;
where, as you can see, the word "COLUMN" comes from some element in the middle of the list drop->type_name() , but the name comes from the first element in the drop list, thus the mismatch. The correct message should've been
ERROR 1091 (42000): Can't DROP COLUMN `t2_id`; check that it exists
Marko Mäkelä
added a comment - Oh, I see that the error message had been refined to include the type of the object , in MariaDB Server 10.2. I can’t find in InnoDB the code snippet that you quoted in mariadb-10.8.3, or in any head of current version branch.
People
Sergei Golubchik
Karl Levik
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":743,"ttfb":149.10000014305115,"pageVisibility":"visible","entityId":127403,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"6feb92f8-353a-4797-8ce7-2024e3e380f8","navigationType":0,"readyForUser":807.7000000476837,"redirectCount":0,"resourceLoadedEnd":848,"resourceLoadedStart":154,"resourceTiming":[{"duration":15.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":154,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":154,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":169.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":15.599999904632568,"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":154.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":154.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":169.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":104.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":154.40000009536743,"connectEnd":154.40000009536743,"connectStart":154.40000009536743,"domainLookupEnd":154.40000009536743,"domainLookupStart":154.40000009536743,"fetchStart":154.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":154.40000009536743,"responseEnd":258.60000014305115,"responseStart":258.60000014305115,"secureConnectionStart":154.40000009536743},{"duration":129,"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":154.5,"connectEnd":154.5,"connectStart":154.5,"domainLookupEnd":154.5,"domainLookupStart":154.5,"fetchStart":154.5,"redirectEnd":0,"redirectStart":0,"requestStart":154.5,"responseEnd":283.5,"responseStart":283.5,"secureConnectionStart":154.5},{"duration":132.5,"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":154.60000014305115,"connectEnd":154.60000014305115,"connectStart":154.60000014305115,"domainLookupEnd":154.60000014305115,"domainLookupStart":154.60000014305115,"fetchStart":154.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":154.60000014305115,"responseEnd":287.10000014305115,"responseStart":287.10000014305115,"secureConnectionStart":154.60000014305115},{"duration":132.90000009536743,"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":154.70000004768372,"connectEnd":154.70000004768372,"connectStart":154.70000004768372,"domainLookupEnd":154.70000004768372,"domainLookupStart":154.70000004768372,"fetchStart":154.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":154.70000004768372,"responseEnd":287.60000014305115,"responseStart":287.60000014305115,"secureConnectionStart":154.70000004768372},{"duration":133.09999990463257,"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":154.80000019073486,"connectEnd":154.80000019073486,"connectStart":154.80000019073486,"domainLookupEnd":154.80000019073486,"domainLookupStart":154.80000019073486,"fetchStart":154.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":154.80000019073486,"responseEnd":287.90000009536743,"responseStart":287.90000009536743,"secureConnectionStart":154.80000019073486},{"duration":134,"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":154.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":154.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":288.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":134.20000004768372,"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":155.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":155.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":289.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":133.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":155.10000014305115,"connectEnd":155.10000014305115,"connectStart":155.10000014305115,"domainLookupEnd":155.10000014305115,"domainLookupStart":155.10000014305115,"fetchStart":155.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":155.10000014305115,"responseEnd":288.40000009536743,"responseStart":288.40000009536743,"secureConnectionStart":155.10000014305115},{"duration":133.59999990463257,"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":155.30000019073486,"connectEnd":155.30000019073486,"connectStart":155.30000019073486,"domainLookupEnd":155.30000019073486,"domainLookupStart":155.30000019073486,"fetchStart":155.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":155.30000019073486,"responseEnd":288.90000009536743,"responseStart":288.90000009536743,"secureConnectionStart":155.30000019073486},{"duration":388.2999999523163,"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":160.70000004768372,"connectEnd":160.70000004768372,"connectStart":160.70000004768372,"domainLookupEnd":160.70000004768372,"domainLookupStart":160.70000004768372,"fetchStart":160.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":160.70000004768372,"responseEnd":549,"responseStart":549,"secureConnectionStart":160.70000004768372},{"duration":509.09999990463257,"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":161.40000009536743,"connectEnd":161.40000009536743,"connectStart":161.40000009536743,"domainLookupEnd":161.40000009536743,"domainLookupStart":161.40000009536743,"fetchStart":161.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":161.40000009536743,"responseEnd":670.5,"responseStart":670.5,"secureConnectionStart":161.40000009536743},{"duration":138.10000014305115,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":482.5,"connectEnd":482.5,"connectStart":482.5,"domainLookupEnd":482.5,"domainLookupStart":482.5,"fetchStart":482.5,"redirectEnd":0,"redirectStart":0,"requestStart":482.5,"responseEnd":620.6000001430511,"responseStart":620.6000001430511,"secureConnectionStart":482.5},{"duration":153.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":694.2000000476837,"connectEnd":694.2000000476837,"connectStart":694.2000000476837,"domainLookupEnd":694.2000000476837,"domainLookupStart":694.2000000476837,"fetchStart":694.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":694.2000000476837,"responseEnd":848,"responseStart":848,"secureConnectionStart":694.2000000476837}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":22,"responseStart":149,"responseEnd":161,"domLoading":152,"domInteractive":870,"domContentLoadedEventStart":870,"domContentLoadedEventEnd":910,"domComplete":1391,"loadEventStart":1391,"loadEventEnd":1391,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":840.1000001430511},{"name":"bigPipe.sidebar-id.end","time":840.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":841.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":843.2000000476837},{"name":"activityTabFullyLoaded","time":930.3000001907349}],"measures":[],"correlationId":"3e7d7af744dc0d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":78,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
It looks like this issue exists since the creation of MariaDB Server 10.0 when some code was imported from MySQL 5.6. Both in MySQL and MariaDB, InnoDB specific error messages were discouraged, so I had used the closest applicable one, ER_CANT_DROP_FIELD_OR_KEY, in WL#5545 Implement simple in-place ALTER TABLE operations: DROP_FOREIGN_KEY (MySQL 5.6.6).