Since ERROR ON ERROR is set in the following query, I would expect it to fail with the error code ER_JSON_TABLE_MULTIPLE_MATCHES . However, the query succeeds, and JSON_TABLE() returns the first match:
SELECT *
FROM JSON_TABLE(
'[
{"first_name": "John", "first_name": "Jonathan", "last_name": "Smith", "email": "john.smith@example.com"},
{"first_name": "Jon", "last_name": "Smith", "email": "jon.smith@example.com"},
{"first_name": "Johnny", "last_name": "Smith", "email": "john.smith@example.com"}
]' ,
'$[*]'
COLUMNS(
rowid FOR ORDINALITY,
first_name VARCHAR (10) PATH '$.first_name' ERROR ON ERROR,
last_name VARCHAR (10) PATH '$.last_name' ERROR ON ERROR,
email VARCHAR (50) PATH '$.email' ERROR ON ERROR
)
) AS people;
See here:
+-------+------------+-----------+------------------------+
| rowid | first_name | last_name | email |
+-------+------------+-----------+------------------------+
| 1 | John | Smith | john.smith@example.com |
| 2 | Jon | Smith | jon.smith@example.com |
| 3 | Johnny | Smith | john.smith@example.com |
+-------+------------+-----------+------------------------+
relates to
MDEV-17399
Add support for JSON_TABLE
Closed
Sergei Golubchik
made changes -
2021-12-06 21:35
Workflow
MariaDB v3
[ 123927
]
MariaDB v4
[ 143041
]
{"report":{"fcp":1038.8000001907349,"ttfb":307.7000002861023,"pageVisibility":"visible","entityId":101586,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"c0cff06a-72b4-44b9-85c3-a8d575b432e8","navigationType":0,"readyForUser":1167.3000001907349,"redirectCount":0,"resourceLoadedEnd":745.8000001907349,"resourceLoadedStart":313.59999990463257,"resourceTiming":[{"duration":15.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":313.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":313.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":16,"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":313.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":313.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":204.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":314,"connectEnd":314,"connectStart":314,"domainLookupEnd":314,"domainLookupStart":314,"fetchStart":314,"redirectEnd":0,"redirectStart":0,"requestStart":333.90000009536743,"responseEnd":518.0999999046326,"responseStart":352.7000002861023,"secureConnectionStart":314},{"duration":389.3999996185303,"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":314.2000002861023,"connectEnd":314.2000002861023,"connectStart":314.2000002861023,"domainLookupEnd":314.2000002861023,"domainLookupStart":314.2000002861023,"fetchStart":314.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":334.40000009536743,"responseEnd":703.5999999046326,"responseStart":366.5,"secureConnectionStart":314.2000002861023},{"duration":53.5,"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":314.40000009536743,"connectEnd":314.40000009536743,"connectStart":314.40000009536743,"domainLookupEnd":314.40000009536743,"domainLookupStart":314.40000009536743,"fetchStart":314.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":344.7000002861023,"responseEnd":367.90000009536743,"responseStart":363.7000002861023,"secureConnectionStart":314.40000009536743},{"duration":53.60000038146973,"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":314.59999990463257,"connectEnd":314.59999990463257,"connectStart":314.59999990463257,"domainLookupEnd":314.59999990463257,"domainLookupStart":314.59999990463257,"fetchStart":314.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":345.09999990463257,"responseEnd":368.2000002861023,"responseStart":364.7000002861023,"secureConnectionStart":314.59999990463257},{"duration":54.5,"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":314.80000019073486,"connectEnd":314.80000019073486,"connectStart":314.80000019073486,"domainLookupEnd":314.80000019073486,"domainLookupStart":314.80000019073486,"fetchStart":314.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":345.5,"responseEnd":369.30000019073486,"responseStart":365.59999990463257,"secureConnectionStart":314.80000019073486},{"duration":26.59999990463257,"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":315,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":315,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":341.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":55.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":315.09999990463257,"connectEnd":315.09999990463257,"connectStart":315.09999990463257,"domainLookupEnd":315.09999990463257,"domainLookupStart":315.09999990463257,"fetchStart":315.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":347,"responseEnd":371,"responseStart":368.30000019073486,"secureConnectionStart":315.09999990463257},{"duration":26.5,"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":315.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":315.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":341.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":63,"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":315.5,"connectEnd":315.5,"connectStart":315.5,"domainLookupEnd":315.5,"domainLookupStart":315.5,"fetchStart":315.5,"redirectEnd":0,"redirectStart":0,"requestStart":350.2000002861023,"responseEnd":378.5,"responseStart":374.09999990463257,"secureConnectionStart":315.5},{"duration":429,"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":316.40000009536743,"connectEnd":316.40000009536743,"connectStart":316.40000009536743,"domainLookupEnd":316.40000009536743,"domainLookupStart":316.40000009536743,"fetchStart":316.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":375.2000002861023,"responseEnd":745.4000000953674,"responseStart":740.5999999046326,"secureConnectionStart":316.40000009536743},{"duration":429.40000009536743,"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":316.40000009536743,"connectEnd":316.40000009536743,"connectStart":316.40000009536743,"domainLookupEnd":316.40000009536743,"domainLookupStart":316.40000009536743,"fetchStart":316.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":389.09999990463257,"responseEnd":745.8000001907349,"responseStart":741.9000000953674,"secureConnectionStart":316.40000009536743},{"duration":179.2999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":672.3000001907349,"connectEnd":672.3000001907349,"connectStart":672.3000001907349,"domainLookupEnd":672.3000001907349,"domainLookupStart":672.3000001907349,"fetchStart":672.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":816.0999999046326,"responseEnd":851.5999999046326,"responseStart":850.9000000953674,"secureConnectionStart":672.3000001907349},{"duration":338.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":958.5,"connectEnd":958.5,"connectStart":958.5,"domainLookupEnd":958.5,"domainLookupStart":958.5,"fetchStart":958.5,"redirectEnd":0,"redirectStart":0,"requestStart":1261.5999999046326,"responseEnd":1297.0999999046326,"responseStart":1296.4000000953674,"secureConnectionStart":958.5}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":67,"responseStart":308,"responseEnd":311,"domLoading":312,"domInteractive":1274,"domContentLoadedEventStart":1274,"domContentLoadedEventEnd":1342,"domComplete":2523,"loadEventStart":2523,"loadEventEnd":2524,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1246.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1247.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1247.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1250.4000000953674},{"name":"activityTabFullyLoaded","time":1364.5999999046326}],"measures":[],"correlationId":"2e4410dec367d7","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":149,"dbReadsTimeInMs":19,"dbConnsTimeInMs":29,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}