These two scripts:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DATETIME);
|
INSERT INTO t1 VALUES (1000);
|
SELECT * FROM t1;
|
DROP TABLE IF EXISTS t1,t2;
|
CREATE TABLE t1 (a DATETIME);
|
CREATE TABLE t2 (a INT);
|
INSERT INTO t2 VALUES (1000);
|
INSERT INTO t1 SELECT * FROM t2;
|
SELECT * FROM t1;
|
return
+---------------------+
|
| a |
|
+---------------------+
|
| 2000-10-00 00:00:00 |
|
+---------------------+
|
This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a INT);
|
INSERT INTO t1 VALUES (1000);
|
ALTER TABLE t1 MODIFY a DATETIME;
|
SELECT * FROM t1;
|
returns a different result:
+---------------------+
|
| a |
|
+---------------------+
|
| 0000-00-00 00:00:00 |
|
+---------------------+
|
All three cases are expected to return the same result.
- blocks
-
MDEV-4912
Data type plugin API version 1
-
-
Closed
{"report":{"fcp":1068.5,"ttfb":477.80000019073486,"pageVisibility":"visible","entityId":54935,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"1e9ccd37-c79f-480f-88c7-8adae30d561c","navigationType":0,"readyForUser":1146.9000000953674,"redirectCount":0,"resourceLoadedEnd":974.8000001907349,"resourceLoadedStart":485.09999990463257,"resourceTiming":[{"duration":98.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":485.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":485.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":583.5,"responseStart":0,"secureConnectionStart":0},{"duration":99.2999997138977,"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":485.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":485.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":584.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":138.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":485.5,"connectEnd":485.5,"connectStart":485.5,"domainLookupEnd":485.5,"domainLookupStart":485.5,"fetchStart":485.5,"redirectEnd":0,"redirectStart":0,"requestStart":586.0999999046326,"responseEnd":623.7000002861023,"responseStart":597.7000002861023,"secureConnectionStart":485.5},{"duration":148.09999990463257,"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":485.7000002861023,"connectEnd":485.7000002861023,"connectStart":485.7000002861023,"domainLookupEnd":485.7000002861023,"domainLookupStart":485.7000002861023,"fetchStart":485.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":587.2000002861023,"responseEnd":633.8000001907349,"responseStart":601.7000002861023,"secureConnectionStart":485.7000002861023},{"duration":115.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":485.90000009536743,"connectEnd":485.90000009536743,"connectStart":485.90000009536743,"domainLookupEnd":485.90000009536743,"domainLookupStart":485.90000009536743,"fetchStart":485.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":588.7000002861023,"responseEnd":601.5999999046326,"responseStart":601,"secureConnectionStart":485.90000009536743},{"duration":124,"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":486.09999990463257,"connectEnd":486.09999990463257,"connectStart":486.09999990463257,"domainLookupEnd":486.09999990463257,"domainLookupStart":486.09999990463257,"fetchStart":486.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":590.0999999046326,"responseEnd":610.0999999046326,"responseStart":609.5,"secureConnectionStart":486.09999990463257},{"duration":126.09999990463257,"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":486.2000002861023,"connectEnd":486.2000002861023,"connectStart":486.2000002861023,"domainLookupEnd":486.2000002861023,"domainLookupStart":486.2000002861023,"fetchStart":486.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":592.5999999046326,"responseEnd":612.3000001907349,"responseStart":611.4000000953674,"secureConnectionStart":486.2000002861023},{"duration":104.5,"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":486.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":486.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":590.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":128.10000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":486.59999990463257,"connectEnd":486.59999990463257,"connectStart":486.59999990463257,"domainLookupEnd":486.59999990463257,"domainLookupStart":486.59999990463257,"fetchStart":486.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":595.5,"responseEnd":614.7000002861023,"responseStart":614.2000002861023,"secureConnectionStart":486.59999990463257},{"duration":107,"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":486.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":486.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":593.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":133.09999990463257,"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":486.90000009536743,"connectEnd":603.0999999046326,"connectStart":603.0999999046326,"domainLookupEnd":603.0999999046326,"domainLookupStart":603.0999999046326,"fetchStart":486.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":603.8000001907349,"responseEnd":620,"responseStart":617.0999999046326,"secureConnectionStart":603.0999999046326},{"duration":480,"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":494.80000019073486,"connectEnd":494.80000019073486,"connectStart":494.80000019073486,"domainLookupEnd":494.80000019073486,"domainLookupStart":494.80000019073486,"fetchStart":494.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":744.8000001907349,"responseEnd":974.8000001907349,"responseStart":970.9000000953674,"secureConnectionStart":494.80000019073486},{"duration":475.59999990463257,"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":498.7000002861023,"connectEnd":498.7000002861023,"connectStart":498.7000002861023,"domainLookupEnd":498.7000002861023,"domainLookupStart":498.7000002861023,"fetchStart":498.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":861.2000002861023,"responseEnd":974.3000001907349,"responseStart":968.3000001907349,"secureConnectionStart":498.7000002861023},{"duration":190.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":817.9000000953674,"connectEnd":817.9000000953674,"connectStart":817.9000000953674,"domainLookupEnd":817.9000000953674,"domainLookupStart":817.9000000953674,"fetchStart":817.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":974.9000000953674,"responseEnd":1008.7000002861023,"responseStart":1008,"secureConnectionStart":817.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":320,"responseStart":477,"responseEnd":498,"domLoading":481,"domInteractive":1209,"domContentLoadedEventStart":1209,"domContentLoadedEventEnd":1246,"domComplete":1827,"loadEventStart":1827,"loadEventEnd":1827,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1186.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1187.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1187.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1189.0999999046326},{"name":"activityTabFullyLoaded","time":1265.2000002861023}],"measures":[],"correlationId":"93e0586a12d096","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":90,"dbReadsTimeInMs":12,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The same problem is repeatable with the DECIMAL data type:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES (1000.0);
SELECT * FROM t1;
and
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a DATETIME);
CREATE TABLE t2 (a DECIMAL(4,0));
INSERT INTO t2 VALUES (1000);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
return
+---------------------+
| a |
+---------------------+
| 2000-10-00 00:00:00 |
+---------------------+
While this script:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL(4,0));
INSERT INTO t1 VALUES (1000);
ALTER TABLE t1 MODIFY a DATETIME;
SELECT * FROM t1;
returns
+---------------------+
| a |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+