Add support of referential constraints directly in column defininions:
createtable t1 (id1 intprimarykey);
createtable t2 (id2 intreferences t1(id1));
Referenced field name can be omitted if equal to foreign field name:
createtable t1 (id intprimarykey);
createtable t2 (id intreferences t1);
Until 10.5 this syntax was understood by the parser but was silently
ignored.
In case of generated columns this syntax is disabled at parser level
by ER_PARSE_ERROR. Note that separate FOREIGN KEY clause for generated
columns is disabled at storage engine level.
Note: MariaDB accepts the REFERENCES clause in ALTER TABLE and CREATE TABLE column definitions, but that syntax does nothing. MariaDB simply parses it without returning any error or warning, for compatibility with other DBMS's.
Matthias Wallnöfer
added a comment - I guess that the documentation hasn't been updated yet in order to reflect the change: https://mariadb.com/kb/en/create-table/#column-definitions
Note: MariaDB accepts the REFERENCES clause in ALTER TABLE and CREATE TABLE column definitions, but that syntax does nothing . MariaDB simply parses it without returning any error or warning, for compatibility with other DBMS's.
Matthias Wallnöfer
added a comment - Just as a follow-up: I have noticed that the bug has been filed against MySQL 8.0 too: https://bugs.mysql.com/bug.php?id=102904 .
People
Aleksey Midenkov
Aleksey Midenkov
Votes:
0Vote for this issue
Watchers:
3Start 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":1448.3999996185303,"ttfb":575.5,"pageVisibility":"visible","entityId":79436,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"f72d9f02-9f96-4e18-88ee-7be5aef5108b","navigationType":0,"readyForUser":1543.3999996185303,"redirectCount":0,"resourceLoadedEnd":1604.5999999046326,"resourceLoadedStart":580.7999997138977,"resourceTiming":[{"duration":373.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":580.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":580.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":954.5,"responseStart":0,"secureConnectionStart":0},{"duration":373.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":581.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":581.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":954.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":383,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":581.2999997138977,"connectEnd":581.2999997138977,"connectStart":581.2999997138977,"domainLookupEnd":581.2999997138977,"domainLookupStart":581.2999997138977,"fetchStart":581.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":581.2999997138977,"responseEnd":964.2999997138977,"responseStart":964.2999997138977,"secureConnectionStart":581.2999997138977},{"duration":444.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":581.3999996185303,"connectEnd":581.3999996185303,"connectStart":581.3999996185303,"domainLookupEnd":581.3999996185303,"domainLookupStart":581.3999996185303,"fetchStart":581.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":581.3999996185303,"responseEnd":1025.7999997138977,"responseStart":1025.7999997138977,"secureConnectionStart":581.3999996185303},{"duration":447.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":581.6999998092651,"connectEnd":581.6999998092651,"connectStart":581.6999998092651,"domainLookupEnd":581.6999998092651,"domainLookupStart":581.6999998092651,"fetchStart":581.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":581.6999998092651,"responseEnd":1029.3999996185303,"responseStart":1029.3999996185303,"secureConnectionStart":581.6999998092651},{"duration":448.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":581.7999997138977,"connectEnd":581.7999997138977,"connectStart":581.7999997138977,"domainLookupEnd":581.7999997138977,"domainLookupStart":581.7999997138977,"fetchStart":581.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":581.7999997138977,"responseEnd":1029.8999996185303,"responseStart":1029.8999996185303,"secureConnectionStart":581.7999997138977},{"duration":448.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":582.0999999046326,"connectEnd":582.0999999046326,"connectStart":582.0999999046326,"domainLookupEnd":582.0999999046326,"domainLookupStart":582.0999999046326,"fetchStart":582.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":582.0999999046326,"responseEnd":1030.2999997138977,"responseStart":1030.2999997138977,"secureConnectionStart":582.0999999046326},{"duration":525.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":582.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":582.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1107.5,"responseStart":0,"secureConnectionStart":0},{"duration":448.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":582.3999996185303,"connectEnd":582.3999996185303,"connectStart":582.3999996185303,"domainLookupEnd":582.3999996185303,"domainLookupStart":582.3999996185303,"fetchStart":582.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":582.3999996185303,"responseEnd":1030.6999998092651,"responseStart":1030.6999998092651,"secureConnectionStart":582.3999996185303},{"duration":525,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":582.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":582.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1107.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":448.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":582.6999998092651,"connectEnd":582.6999998092651,"connectStart":582.6999998092651,"domainLookupEnd":582.6999998092651,"domainLookupStart":582.6999998092651,"fetchStart":582.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":582.6999998092651,"responseEnd":1031.2999997138977,"responseStart":1031.2999997138977,"secureConnectionStart":582.6999998092651},{"duration":715,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":588.3999996185303,"connectEnd":588.3999996185303,"connectStart":588.3999996185303,"domainLookupEnd":588.3999996185303,"domainLookupStart":588.3999996185303,"fetchStart":588.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":588.3999996185303,"responseEnd":1303.3999996185303,"responseStart":1303.3999996185303,"secureConnectionStart":588.3999996185303},{"duration":924.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":588.5,"connectEnd":588.5,"connectStart":588.5,"domainLookupEnd":588.5,"domainLookupStart":588.5,"fetchStart":588.5,"redirectEnd":0,"redirectStart":0,"requestStart":588.5,"responseEnd":1512.6999998092651,"responseStart":1512.6999998092651,"secureConnectionStart":588.5},{"duration":187.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1119.7999997138977,"connectEnd":1119.7999997138977,"connectStart":1119.7999997138977,"domainLookupEnd":1119.7999997138977,"domainLookupStart":1119.7999997138977,"fetchStart":1119.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1119.7999997138977,"responseEnd":1307.3999996185303,"responseStart":1307.3999996185303,"secureConnectionStart":1119.7999997138977},{"duration":225.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&slack-enabled=true&whisper-enabled=true","startTime":1378.8999996185303,"connectEnd":1378.8999996185303,"connectStart":1378.8999996185303,"domainLookupEnd":1378.8999996185303,"domainLookupStart":1378.8999996185303,"fetchStart":1378.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":1378.8999996185303,"responseEnd":1604.5999999046326,"responseStart":1604.5999999046326,"secureConnectionStart":1378.8999996185303}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":168,"responseStart":576,"responseEnd":580,"domLoading":579,"domInteractive":1649,"domContentLoadedEventStart":1649,"domContentLoadedEventEnd":1691,"domComplete":2053,"loadEventStart":2053,"loadEventEnd":2054,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1632.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1633.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1633.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1634.5999999046326},{"name":"activityTabFullyLoaded","time":1709.5}],"measures":[],"correlationId":"430ede55fb65a","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I guess that the documentation hasn't been updated yet in order to reflect the change: https://mariadb.com/kb/en/create-table/#column-definitions