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":860.8000001907349,"ttfb":209.5,"pageVisibility":"visible","entityId":59171,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"7908fe65-b732-4c6b-8325-af7bc40666eb","navigationType":0,"readyForUser":956,"redirectCount":0,"resourceLoadedEnd":582.9000000953674,"resourceLoadedStart":217.59999990463257,"resourceTiming":[{"duration":44.200000286102295,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":217.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":217.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":261.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":44.09999990463257,"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":218,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":218,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":262.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":238.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":218.09999990463257,"connectEnd":218.09999990463257,"connectStart":218.09999990463257,"domainLookupEnd":218.09999990463257,"domainLookupStart":218.09999990463257,"fetchStart":218.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":265.09999990463257,"responseEnd":456.40000009536743,"responseStart":285,"secureConnectionStart":218.09999990463257},{"duration":348.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":218.30000019073486,"connectEnd":218.30000019073486,"connectStart":218.30000019073486,"domainLookupEnd":218.30000019073486,"domainLookupStart":218.30000019073486,"fetchStart":218.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":265.5,"responseEnd":566.4000000953674,"responseStart":278.30000019073486,"secureConnectionStart":218.30000019073486},{"duration":59.700000286102295,"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":218.5,"connectEnd":218.5,"connectStart":218.5,"domainLookupEnd":218.5,"domainLookupStart":218.5,"fetchStart":218.5,"redirectEnd":0,"redirectStart":0,"requestStart":266,"responseEnd":278.2000002861023,"responseStart":276,"secureConnectionStart":218.5},{"duration":72.09999990463257,"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":218.7000002861023,"connectEnd":218.7000002861023,"connectStart":218.7000002861023,"domainLookupEnd":218.7000002861023,"domainLookupStart":218.7000002861023,"fetchStart":218.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":269.40000009536743,"responseEnd":290.80000019073486,"responseStart":288.90000009536743,"secureConnectionStart":218.7000002861023},{"duration":72.2999997138977,"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":218.80000019073486,"connectEnd":218.80000019073486,"connectStart":218.80000019073486,"domainLookupEnd":218.80000019073486,"domainLookupStart":218.80000019073486,"fetchStart":218.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":269.59999990463257,"responseEnd":291.09999990463257,"responseStart":289.40000009536743,"secureConnectionStart":218.80000019073486},{"duration":49.30000019073486,"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":219.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":219.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":268.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":74,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":219.30000019073486,"connectEnd":219.30000019073486,"connectStart":219.30000019073486,"domainLookupEnd":219.30000019073486,"domainLookupStart":219.30000019073486,"fetchStart":219.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":271.7000002861023,"responseEnd":293.30000019073486,"responseStart":291.80000019073486,"secureConnectionStart":219.30000019073486},{"duration":49.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":219.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":219.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":269.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":75.39999961853027,"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":219.7000002861023,"connectEnd":219.7000002861023,"connectStart":219.7000002861023,"domainLookupEnd":219.7000002861023,"domainLookupStart":219.7000002861023,"fetchStart":219.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":273.09999990463257,"responseEnd":295.09999990463257,"responseStart":293.5,"secureConnectionStart":219.7000002861023},{"duration":358.90000009536743,"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":223.40000009536743,"connectEnd":223.40000009536743,"connectStart":223.40000009536743,"domainLookupEnd":223.40000009536743,"domainLookupStart":223.40000009536743,"fetchStart":223.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":377.59999990463257,"responseEnd":582.3000001907349,"responseStart":576.0999999046326,"secureConnectionStart":223.40000009536743},{"duration":358.80000019073486,"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":224.09999990463257,"connectEnd":224.09999990463257,"connectStart":224.09999990463257,"domainLookupEnd":224.09999990463257,"domainLookupStart":224.09999990463257,"fetchStart":224.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":433.59999990463257,"responseEnd":582.9000000953674,"responseStart":577.5,"secureConnectionStart":224.09999990463257},{"duration":255.7999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":587.7000002861023,"connectEnd":587.7000002861023,"connectStart":587.7000002861023,"domainLookupEnd":587.7000002861023,"domainLookupStart":587.7000002861023,"fetchStart":587.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":805.9000000953674,"responseEnd":843.5,"responseStart":842.4000000953674,"secureConnectionStart":587.7000002861023}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":52,"responseStart":209,"responseEnd":224,"domLoading":213,"domInteractive":1026,"domContentLoadedEventStart":1027,"domContentLoadedEventEnd":1083,"domComplete":1922,"loadEventStart":1922,"loadEventEnd":1922,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1001.5},{"name":"bigPipe.sidebar-id.end","time":1002.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1002.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1003.5},{"name":"activityTabFullyLoaded","time":1099.7000002861023}],"measures":[],"correlationId":"fa2d10be293840","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":92,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
http://lists.askmonty.org/pipermail/commits/2016-December/010184.html