Type:
Bug
Priority:
Minor
Resolution:
Unresolved
Affects Version/s:
N/A
With explicit_defaults_on_timestamp=OFF , which is still default in MariaDB, a JSON_TABLE column of type TIMESTAMP is always not null with default value '0000-00-00 00:00:00', and there seems to be no way to override it:
bb-10.6-mdev17399-hf c3cb41111
MariaDB [test]> select * from json_table( '{}' , '$' columns(a timestamp path '$' , b datetime path '$' )) jt;
+ ---------------------+------+
| a | b |
+ ---------------------+------+
| 0000-00-00 00:00:00 | NULL |
+ ---------------------+------+
1 row in set (0.001 sec)
Column type info
Field 1: `a`
Catalog: `def`
Database: ``
Table: `jt`
Org_table: ``
Type: TIMESTAMP
Collation: binary (63)
Length: 19
Max_length: 19
Decimals: 0
Flags: NOT_NULL UNSIGNED BINARY
Field 2: `b`
Catalog: `def`
Database: ``
Table: `jt`
Org_table: ``
Type: DATETIME
Collation: binary (63)
Length: 19
Max_length: 0
Decimals: 0
Flags: BINARY
Even when the value is an explicit null, it's still converted to zero time:
select * from json_table( '[null]' , '$' columns(a timestamp path '$[0]' error on error error on empty, b datetime path '$[0]' error on error error on empty)) jt;
+ ---------------------+------+
| a | b |
+ ---------------------+------+
| 0000-00-00 00:00:00 | NULL |
+ ---------------------+------+
1 row in set (0.001 sec)
The result is the same in MySQL with explicit_defaults_on_timestamp=OFF , but the big difference is that in MySQL explicit_defaults_on_timestamp is ON by default, the variable is deprecated, and it's changeable at runtime. In MariaDB it's all the opposite.
It causes further issues when JSON_TABLE is used in a table-changing context with SQL_MODE=NO_ZERO_DATE (which is a part of some group SQL modes, e.g. TRADITIONAL ):
MariaDB [test]> set sql_mode= 'NO_ZERO_DATE' ;
Query OK, 0 rows affected (0.000 sec)
MariaDB [test]> create or replace table t as select * from json_table( '{}' , '$' columns (a timestamp path '$' )) jt;
ERROR 1067 (42000): Invalid default value for 'a'
relates to
MDEV-17399
Add support for JSON_TABLE
Closed
{"report":{"fcp":1372.8000001907349,"ttfb":184.90000009536743,"pageVisibility":"visible","entityId":98943,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"b21655ed-50c0-4f44-9e16-a11b7812335e","navigationType":0,"readyForUser":1495.9000000953674,"redirectCount":0,"resourceLoadedEnd":1870.0999999046326,"resourceLoadedStart":207.40000009536743,"resourceTiming":[{"duration":542.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":207.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":207.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":749.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":542.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":207.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":207.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":750.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":551.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":207.80000019073486,"connectEnd":207.80000019073486,"connectStart":207.80000019073486,"domainLookupEnd":207.80000019073486,"domainLookupStart":207.80000019073486,"fetchStart":207.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":207.80000019073486,"responseEnd":759.5,"responseStart":759.5,"secureConnectionStart":207.80000019073486},{"duration":579.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":207.90000009536743,"connectEnd":207.90000009536743,"connectStart":207.90000009536743,"domainLookupEnd":207.90000009536743,"domainLookupStart":207.90000009536743,"fetchStart":207.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":207.90000009536743,"responseEnd":787.5999999046326,"responseStart":787.5999999046326,"secureConnectionStart":207.90000009536743},{"duration":585,"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":208.2000002861023,"connectEnd":208.2000002861023,"connectStart":208.2000002861023,"domainLookupEnd":208.2000002861023,"domainLookupStart":208.2000002861023,"fetchStart":208.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":208.2000002861023,"responseEnd":793.2000002861023,"responseStart":793.2000002861023,"secureConnectionStart":208.2000002861023},{"duration":585.5,"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":208.30000019073486,"connectEnd":208.30000019073486,"connectStart":208.30000019073486,"domainLookupEnd":208.30000019073486,"domainLookupStart":208.30000019073486,"fetchStart":208.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":208.30000019073486,"responseEnd":793.8000001907349,"responseStart":793.8000001907349,"secureConnectionStart":208.30000019073486},{"duration":584.9000000953674,"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":209.5,"connectEnd":209.5,"connectStart":209.5,"domainLookupEnd":209.5,"domainLookupStart":209.5,"fetchStart":209.5,"redirectEnd":0,"redirectStart":0,"requestStart":209.5,"responseEnd":794.4000000953674,"responseStart":794.4000000953674,"secureConnectionStart":209.5},{"duration":585.2999997138977,"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":209.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":795,"responseStart":0,"secureConnectionStart":0},{"duration":585,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":210,"connectEnd":210,"connectStart":210,"domainLookupEnd":210,"domainLookupStart":210,"fetchStart":210,"redirectEnd":0,"redirectStart":0,"requestStart":210,"responseEnd":795,"responseStart":795,"secureConnectionStart":210},{"duration":722,"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":210.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":210.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":932.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":585.1999998092651,"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":210.40000009536743,"connectEnd":210.40000009536743,"connectStart":210.40000009536743,"domainLookupEnd":210.40000009536743,"domainLookupStart":210.40000009536743,"fetchStart":210.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":210.40000009536743,"responseEnd":795.5999999046326,"responseStart":795.5999999046326,"secureConnectionStart":210.40000009536743},{"duration":849.9000000953674,"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":212.09999990463257,"connectEnd":212.09999990463257,"connectStart":212.09999990463257,"domainLookupEnd":212.09999990463257,"domainLookupStart":212.09999990463257,"fetchStart":212.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":212.09999990463257,"responseEnd":1062,"responseStart":1062,"secureConnectionStart":212.09999990463257},{"duration":1657.8999996185303,"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":212.2000002861023,"connectEnd":212.2000002861023,"connectStart":212.2000002861023,"domainLookupEnd":212.2000002861023,"domainLookupStart":212.2000002861023,"fetchStart":212.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":212.2000002861023,"responseEnd":1870.0999999046326,"responseStart":1870.0999999046326,"secureConnectionStart":212.2000002861023},{"duration":761.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1097.7000002861023,"connectEnd":1097.7000002861023,"connectStart":1097.7000002861023,"domainLookupEnd":1097.7000002861023,"domainLookupStart":1097.7000002861023,"fetchStart":1097.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":1097.7000002861023,"responseEnd":1859.2000002861023,"responseStart":1859.2000002861023,"secureConnectionStart":1097.7000002861023},{"duration":614.3999996185303,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1365.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1365.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1979.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":20,"responseStart":185,"responseEnd":188,"domLoading":205,"domInteractive":1930,"domContentLoadedEventStart":1930,"domContentLoadedEventEnd":1974,"domComplete":3645,"loadEventStart":3645,"loadEventEnd":3647,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1911.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1911.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1912.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1914.7000002861023},{"name":"activityTabFullyLoaded","time":1984.3000001907349}],"measures":[],"correlationId":"64dc0ae09b1eba","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":87,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}