Function JSON_QUOTE is specified in MySQL manual as
Quotes a string as a JSON value by wrapping it with double quote characters and escaping interior quote and other characters, then returning the result as a utf8mb4 string.
It works in MySQL according to this specification:
+-------------------+
|
| JSON_QUOTE('foo') |
|
+-------------------+
|
| "foo" |
|
+-------------------+
|
1 row in set (0.00 sec)
|
|
MySQL [test]> CREATE TABLE t AS SELECT JSON_QUOTE('foo');
|
Query OK, 1 row affected (0.48 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
MySQL [test]> SHOW CREATE TABLE t \G
|
*************************** 1. row ***************************
|
Table: t
|
Create Table: CREATE TABLE `t` (
|
`JSON_QUOTE('foo')` varchar(56) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
1 row in set (0.00 sec)
|
However, in MariaDB it neither wraps the value in double quote marks, nor does it return result in utf8mb4
+-------------------+
|
| JSON_QUOTE('foo') |
|
+-------------------+
|
| foo |
|
+-------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [test]> CREATE TABLE t SELECT JSON_QUOTE('foo');
|
Query OK, 1 row affected (0.49 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> SHOW CREATE TABLE t \G
|
*************************** 1. row ***************************
|
Table: t
|
Create Table: CREATE TABLE `t` (
|
`JSON_QUOTE('foo')` varchar(36) CHARACTER SET utf8 NOT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
1 row in set (0.00 sec)
|
- relates to
-
MDEV-9143
JSON_xxx functions
-
-
Closed
{"report":{"fcp":1799.6999998092651,"ttfb":513.6000003814697,"pageVisibility":"visible","entityId":59171,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"6d668ec5-5fba-4a6e-b9f8-53a384199e93","navigationType":0,"readyForUser":1881.3999996185303,"redirectCount":0,"resourceLoadedEnd":2085.800000190735,"resourceLoadedStart":519,"resourceTiming":[{"duration":753,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":519,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":519,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1272,"responseStart":0,"secureConnectionStart":0},{"duration":753.3999996185303,"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":519.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":519.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1272.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":808.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":519.5,"connectEnd":519.5,"connectStart":519.5,"domainLookupEnd":519.5,"domainLookupStart":519.5,"fetchStart":519.5,"redirectEnd":0,"redirectStart":0,"requestStart":519.5,"responseEnd":1327.6000003814697,"responseStart":1327.6000003814697,"secureConnectionStart":519.5},{"duration":873.1000003814697,"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":519.6999998092651,"connectEnd":519.6999998092651,"connectStart":519.6999998092651,"domainLookupEnd":519.6999998092651,"domainLookupStart":519.6999998092651,"fetchStart":519.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":519.6999998092651,"responseEnd":1392.8000001907349,"responseStart":1392.6999998092651,"secureConnectionStart":519.6999998092651},{"duration":876.7000007629395,"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":519.8999996185303,"connectEnd":519.8999996185303,"connectStart":519.8999996185303,"domainLookupEnd":519.8999996185303,"domainLookupStart":519.8999996185303,"fetchStart":519.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":519.8999996185303,"responseEnd":1396.6000003814697,"responseStart":1396.6000003814697,"secureConnectionStart":519.8999996185303},{"duration":877,"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":520,"connectEnd":520,"connectStart":520,"domainLookupEnd":520,"domainLookupStart":520,"fetchStart":520,"redirectEnd":0,"redirectStart":0,"requestStart":520,"responseEnd":1397,"responseStart":1397,"secureConnectionStart":520},{"duration":877,"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":520.3000001907349,"connectEnd":520.3000001907349,"connectStart":520.3000001907349,"domainLookupEnd":520.3000001907349,"domainLookupStart":520.3000001907349,"fetchStart":520.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":520.3000001907349,"responseEnd":1397.3000001907349,"responseStart":1397.3000001907349,"secureConnectionStart":520.3000001907349},{"duration":966.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":520.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":520.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1486.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":877.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":520.5,"connectEnd":520.5,"connectStart":520.5,"domainLookupEnd":520.5,"domainLookupStart":520.5,"fetchStart":520.5,"redirectEnd":0,"redirectStart":0,"requestStart":520.5,"responseEnd":1397.8000001907349,"responseStart":1397.8000001907349,"secureConnectionStart":520.5},{"duration":966.3000001907349,"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":520.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":520.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1487,"responseStart":0,"secureConnectionStart":0},{"duration":877.4000005722046,"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":520.8999996185303,"connectEnd":520.8999996185303,"connectStart":520.8999996185303,"domainLookupEnd":520.8999996185303,"domainLookupStart":520.8999996185303,"fetchStart":520.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":520.8999996185303,"responseEnd":1398.3000001907349,"responseStart":1398.3000001907349,"secureConnectionStart":520.8999996185303},{"duration":1444.3000001907349,"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":526.3000001907349,"connectEnd":526.3000001907349,"connectStart":526.3000001907349,"domainLookupEnd":526.3000001907349,"domainLookupStart":526.3000001907349,"fetchStart":526.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":526.3000001907349,"responseEnd":1970.6000003814697,"responseStart":1970.6000003814697,"secureConnectionStart":526.3000001907349},{"duration":1559.4000005722046,"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":526.3999996185303,"connectEnd":526.3999996185303,"connectStart":526.3999996185303,"domainLookupEnd":526.3999996185303,"domainLookupStart":526.3999996185303,"fetchStart":526.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":526.3999996185303,"responseEnd":2085.800000190735,"responseStart":2085.699999809265,"secureConnectionStart":526.3999996185303},{"duration":476.0999994277954,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1498.3000001907349,"connectEnd":1498.3000001907349,"connectStart":1498.3000001907349,"domainLookupEnd":1498.3000001907349,"domainLookupStart":1498.3000001907349,"fetchStart":1498.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1498.3000001907349,"responseEnd":1974.3999996185303,"responseStart":1974.3999996185303,"secureConnectionStart":1498.3000001907349},{"duration":355.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1793.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1793.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2149.300000190735,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":347,"responseStart":514,"responseEnd":520,"domLoading":517,"domInteractive":2105,"domContentLoadedEventStart":2105,"domContentLoadedEventEnd":2146,"domComplete":3254,"loadEventStart":3254,"loadEventEnd":3256,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2087.3999996185303},{"name":"bigPipe.sidebar-id.end","time":2088.199999809265},{"name":"bigPipe.activity-panel-pipe-id.start","time":2088.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":2090.800000190735},{"name":"activityTabFullyLoaded","time":2153.1000003814697}],"measures":[],"correlationId":"34ef67bde7a730","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":103,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}