Currently INTERVAL literals can appear in context of the DATE_ADD function and the operator +.
For example:
SELECT DATE_ADD(OrderDate,INTERVAL 30 DAY) AS OrderPayDate FROM Orders
SELECT OrderDate + INTERVAL 30 DAYAS OrderParDate FROM Orders;
SELECT INTERVAL 30 DAY + OrderDate AS OrderParDate FROM Orders;
We will change INTERVAL from a DATE_ADD and + specific syntax to a full-functional data type, so intervals can appear in all context where a regular data type can, including:
INTERVAL table fields
INTERVAL stored routine variables, parameters, function return values
Hybrid built-in functions and operators, such as COALESCE, IF, CASE, LEAST, GREATEST.
I’ve already drafted a proposal for implementing the INTERVAL,Does this conversation mean that it will not included as a GSoC project idea, and instead be developed internally by the MariaDB community?
Hazem Alrawi
added a comment - I’ve already drafted a proposal for implementing the INTERVAL,Does this conversation mean that it will not included as a GSoC project idea, and instead be developed internally by the MariaDB community?
Does this conversation mean that it will not included as a GSoC project idea, and instead be developed internally by the MariaDB community?
Which do you refer to by ‘it’, “INTERVAL SQL datatype” (this MDEV) or “interval options type” (my comment)?
In theory, it doesn’t matter:
we accept any project ideas, not only from our "ideas" page.
That means we accept both ideas, and you could add both to your GSoC proposal, but keep in mind
Alex is on point stating that doing the “interval options type” as well is a scope creep for this MDEV.
Like those before me said, “INTERVAL SQL datatype” is already a large task.
I too recommend leaving the options to a separate task; you could also pick it up post-GSoC if nobody beats you to it.
Jimmy Hú
added a comment - Does this conversation mean that it will not included as a GSoC project idea, and instead be developed internally by the MariaDB community?
Which do you refer to by ‘it’, “INTERVAL SQL datatype” (this MDEV) or “interval options type” (my comment)?
In theory, it doesn’t matter:
we accept any project ideas, not only from our "ideas" page.
That means we accept both ideas, and you could add both to your GSoC proposal, but keep in mind
Alex is on point stating that doing the “interval options type” as well is a scope creep for this MDEV.
Like those before me said, “INTERVAL SQL datatype” is already a large task.
I too recommend leaving the options to a separate task; you could also pick it up post-GSoC if nobody beats you to it.
Which do you refer to by ‘it’, “INTERVAL SQL datatype” (this MDEV) or “interval options type” (my comment)?
I am referring to interval datatype
I noticed recent activity in the MDEV ticket, which makes me wonder if the community is already working on it and might exclude it from GSoC that's why I asked:
and instead be developed internally by the MariaDB community?
Now I have a clear understanding, I will keep working on INTERVAL SQL datatype.
Thank you!
Hazem Alrawi
added a comment - - edited Which do you refer to by ‘it’, “INTERVAL SQL datatype” (this MDEV) or “interval options type” (my comment)?
I am referring to interval datatype
I noticed recent activity in the MDEV ticket, which makes me wonder if the community is already working on it and might exclude it from GSoC that's why I asked:
and instead be developed internally by the MariaDB community?
Now I have a clear understanding, I will keep working on INTERVAL SQL datatype.
Thank you!
HazemRawi, don't worry, nobody is working on this ticket. There is activity in all SQL-standard-conformance and other-database-compatibility tasks lately.
The INTERVAL type is overdue for a long time. It existed in SQL-1992 already:
<data type> ::=
<character string type> [ CHARACTER SET <character set specification> ]
| <national character string type>
| <bit string type>
| <numeric type>
| <datetime type>
| <interval type>
MariaDB supports all other core SQL data types. INTERVAL is the only one not supported yet.
MySQL/MariaDB DATETIME and TIME data types were originally implemented in the way to support both <datetime type> and <interval type> (with help of NO_ZERO_IN_DATE and NO_ZERO_DATE sql_mode flags and extended TIME range). So this task has always been postponed. But we do need to implement a dedicated data type for INTERVAL. Thanks for volunteering! It'll be a very good addition to conformance and compatibility.
Alexander Barkov
added a comment - - edited HazemRawi , don't worry, nobody is working on this ticket. There is activity in all SQL-standard-conformance and other-database-compatibility tasks lately.
The INTERVAL type is overdue for a long time. It existed in SQL-1992 already:
<data type> ::=
<character string type> [ CHARACTER SET <character set specification> ]
| <national character string type>
| <bit string type>
| <numeric type>
| <datetime type>
| <interval type>
MariaDB supports all other core SQL data types. INTERVAL is the only one not supported yet.
MySQL/MariaDB DATETIME and TIME data types were originally implemented in the way to support both <datetime type> and <interval type> (with help of NO_ZERO_IN_DATE and NO_ZERO_DATE sql_mode flags and extended TIME range). So this task has always been postponed. But we do need to implement a dedicated data type for INTERVAL. Thanks for volunteering! It'll be a very good addition to conformance and compatibility.
I propose implementing the INTERVAL data type with a 16-byte binary storage layout, structured as follows:
-4 bytes: Encodes years and months as a single integer.
-4 bytes: Encodes days as a single integer.
-8 bytes: Encodes hours, minutes, seconds, and fractional seconds as total microseconds.
What are your thoughts on its suitability for MariaDB?
Hazem Alrawi
added a comment - That’s great!
I propose implementing the INTERVAL data type with a 16-byte binary storage layout, structured as follows:
-4 bytes: Encodes years and months as a single integer.
-4 bytes: Encodes days as a single integer.
-8 bytes: Encodes hours, minutes, seconds, and fractional seconds as total microseconds.
What are your thoughts on its suitability for MariaDB?
People
Unassigned
Alexander Barkov
Votes:
1Vote for this issue
Watchers:
7Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":936,"ttfb":229.19999998807907,"pageVisibility":"visible","entityId":60929,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"13de11d4-affe-459d-8c69-cebe4a81e775","navigationType":0,"readyForUser":1020.1999999880791,"redirectCount":0,"resourceLoadedEnd":859.5,"resourceLoadedStart":234.90000000596046,"resourceTiming":[{"duration":202.2999999821186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":234.90000000596046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":437.19999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":202.40000000596046,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":235.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":437.59999999403954,"responseStart":0,"secureConnectionStart":0},{"duration":214.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":235.40000000596046,"connectEnd":235.40000000596046,"connectStart":235.40000000596046,"domainLookupEnd":235.40000000596046,"domainLookupStart":235.40000000596046,"fetchStart":235.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":235.40000000596046,"responseEnd":450.09999999403954,"responseStart":450.09999999403954,"secureConnectionStart":235.40000000596046},{"duration":307.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":235.5,"connectEnd":235.5,"connectStart":235.5,"domainLookupEnd":235.5,"domainLookupStart":235.5,"fetchStart":235.5,"redirectEnd":0,"redirectStart":0,"requestStart":235.5,"responseEnd":543,"responseStart":543,"secureConnectionStart":235.5},{"duration":310.90000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":235.69999998807907,"connectEnd":235.69999998807907,"connectStart":235.69999998807907,"domainLookupEnd":235.69999998807907,"domainLookupStart":235.69999998807907,"fetchStart":235.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":235.69999998807907,"responseEnd":546.5999999940395,"responseStart":546.5999999940395,"secureConnectionStart":235.69999998807907},{"duration":311.09999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":235.90000000596046,"connectEnd":235.90000000596046,"connectStart":235.90000000596046,"domainLookupEnd":235.90000000596046,"domainLookupStart":235.90000000596046,"fetchStart":235.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":235.90000000596046,"responseEnd":547,"responseStart":547,"secureConnectionStart":235.90000000596046},{"duration":311.2999999821186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":236,"connectEnd":236,"connectStart":236,"domainLookupEnd":236,"domainLookupStart":236,"fetchStart":236,"redirectEnd":0,"redirectStart":0,"requestStart":236,"responseEnd":547.2999999821186,"responseStart":547.2999999821186,"secureConnectionStart":236},{"duration":356.2000000178814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":236.2999999821186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":592.5,"responseStart":0,"secureConnectionStart":0},{"duration":311.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":236.40000000596046,"connectEnd":236.40000000596046,"connectStart":236.40000000596046,"domainLookupEnd":236.40000000596046,"domainLookupStart":236.40000000596046,"fetchStart":236.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":236.40000000596046,"responseEnd":547.7999999821186,"responseStart":547.7999999821186,"secureConnectionStart":236.40000000596046},{"duration":356.09999999403954,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":236.59999999403954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":592.6999999880791,"responseStart":0,"secureConnectionStart":0},{"duration":311.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":236.69999998807907,"connectEnd":236.69999998807907,"connectStart":236.69999998807907,"domainLookupEnd":236.69999998807907,"domainLookupStart":236.69999998807907,"fetchStart":236.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":236.69999998807907,"responseEnd":548.2999999821186,"responseStart":548.2999999821186,"secureConnectionStart":236.69999998807907},{"duration":361,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":237.90000000596046,"connectEnd":237.90000000596046,"connectStart":237.90000000596046,"domainLookupEnd":237.90000000596046,"domainLookupStart":237.90000000596046,"fetchStart":237.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":237.90000000596046,"responseEnd":598.9000000059605,"responseStart":598.9000000059605,"secureConnectionStart":237.90000000596046},{"duration":362.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":237.90000000596046,"connectEnd":237.90000000596046,"connectStart":237.90000000596046,"domainLookupEnd":237.90000000596046,"domainLookupStart":237.90000000596046,"fetchStart":237.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":237.90000000596046,"responseEnd":600.0999999940395,"responseStart":600,"secureConnectionStart":237.90000000596046},{"duration":21.900000005960464,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":619.7999999821186,"connectEnd":619.7999999821186,"connectStart":619.7999999821186,"domainLookupEnd":619.7999999821186,"domainLookupStart":619.7999999821186,"fetchStart":619.7999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":619.7999999821186,"responseEnd":641.6999999880791,"responseStart":641.6999999880791,"secureConnectionStart":619.7999999821186},{"duration":214.40000000596046,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":645.0999999940395,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":645.0999999940395,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":859.5,"responseStart":0,"secureConnectionStart":0},{"duration":484.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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":645.9000000059605,"connectEnd":645.9000000059605,"connectStart":645.9000000059605,"domainLookupEnd":645.9000000059605,"domainLookupStart":645.9000000059605,"fetchStart":645.9000000059605,"redirectEnd":0,"redirectStart":0,"requestStart":645.9000000059605,"responseEnd":1130.5,"responseStart":1130.5,"secureConnectionStart":645.9000000059605},{"duration":489.40000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":646.2999999821186,"connectEnd":646.2999999821186,"connectStart":646.2999999821186,"domainLookupEnd":646.2999999821186,"domainLookupStart":646.2999999821186,"fetchStart":646.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":646.2999999821186,"responseEnd":1135.699999988079,"responseStart":1135.699999988079,"secureConnectionStart":646.2999999821186}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":47,"responseStart":229,"responseEnd":233,"domLoading":232,"domInteractive":1087,"domContentLoadedEventStart":1087,"domContentLoadedEventEnd":1137,"domComplete":1570,"loadEventStart":1570,"loadEventEnd":1571,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1061.2999999821186},{"name":"bigPipe.sidebar-id.end","time":1062.0999999940395},{"name":"bigPipe.activity-panel-pipe-id.start","time":1062.199999988079},{"name":"bigPipe.activity-panel-pipe-id.end","time":1064.4000000059605},{"name":"activityTabFullyLoaded","time":1161.199999988079}],"measures":[],"correlationId":"b20d75188d2845","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":118,"dbReadsTimeInMs":17,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I’ve already drafted a proposal for implementing the INTERVAL,Does this conversation mean that it will not included as a GSoC project idea, and instead be developed internally by the MariaDB community?