There seems to be different behaviour when comparing the result of JSON_EXTRACT in MySql 5.7 and Mariadb 10.2.5.
In MySql the following query will result in true, but in mariadb this results in 0.
select JSON_EXTRACT( '{"name":"value"}' , '$.name' ) = 'value' ;
To fix this I tried to just quote the value to compare and it works in mariadb (result: 1) but not in MySql (result: 0).
select JSON_EXTRACT( '{"name":"value"}' , '$.name' ) = JSON_QUOTE( 'value' );
It's also an issue with boolean values:
SET @str = '{\"asdf\":true}' ;
SET @path = "$.\ "asdf\"" ;
select @str, @path, JSON_EXTRACT(@str, @path) = 'true' ; -- mariadb
select @str, @path, JSON_EXTRACT(@str, @path) = true ; -- mysql
Sergei Golubchik
made changes -
2017-04-27 13:46
Field
Original Value
New Value
Component/s
JSON
[ 13908
]
Elena Stepanova
made changes -
2017-05-01 23:29
Fix Version/s
10.2
[ 14601
]
Assignee
Alexey Botchkov
[ holyfoot
]
Armin Preiml
made changes -
2017-05-10 10:54
Description
There seems to be different behaviour when comparing the result of JSON_EXTRACT in MySql 5.7 and Mariadb 10.2.5.
In MySql the following query will result in true, but in mariadb this results in 0.
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
{code}
To fix this I tried to just quote the value to compare and it works in mariadb (result: 1) but not in MySql (result: 0).
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = JSON_QUOTE('value');
{code}
There seems to be different behaviour when comparing the result of JSON_EXTRACT in MySql 5.7 and Mariadb 10.2.5.
In MySql the following query will result in true, but in mariadb this results in 0.
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
{code}
To fix this I tried to just quote the value to compare and it works in mariadb (result: 1) but not in MySql (result: 0).
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = JSON_QUOTE('value');
{code}
It's also an issue with boolean values:
{code:sql}
SET @str = '{\"asdf\":true}';
SET @path = "$.\"asdf\"";
select @str, @path, JSON_EXTRACT(@str, @path) = 'true'; // mariadb
select @str, @path, JSON_EXTRACT(@str, @path) = true; // mysql
{code}
Armin Preiml
made changes -
2017-05-10 12:11
Description
There seems to be different behaviour when comparing the result of JSON_EXTRACT in MySql 5.7 and Mariadb 10.2.5.
In MySql the following query will result in true, but in mariadb this results in 0.
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
{code}
To fix this I tried to just quote the value to compare and it works in mariadb (result: 1) but not in MySql (result: 0).
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = JSON_QUOTE('value');
{code}
It's also an issue with boolean values:
{code:sql}
SET @str = '{\"asdf\":true}';
SET @path = "$.\"asdf\"";
select @str, @path, JSON_EXTRACT(@str, @path) = 'true'; // mariadb
select @str, @path, JSON_EXTRACT(@str, @path) = true; // mysql
{code}
There seems to be different behaviour when comparing the result of JSON_EXTRACT in MySql 5.7 and Mariadb 10.2.5.
In MySql the following query will result in true, but in mariadb this results in 0.
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
{code}
To fix this I tried to just quote the value to compare and it works in mariadb (result: 1) but not in MySql (result: 0).
{code:sql}
select JSON_EXTRACT('{"name":"value"}', '$.name') = JSON_QUOTE('value');
{code}
It's also an issue with boolean values:
{code:sql}
SET @str = '{\"asdf\":true}';
SET @path = "$.\"asdf\"";
select @str, @path, JSON_EXTRACT(@str, @path) = 'true'; -- mariadb
select @str, @path, JSON_EXTRACT(@str, @path) = true; -- mysql
{code}
Alexey Botchkov
made changes -
2017-08-07 10:40
Status
Open
[ 1
]
In Progress
[ 3
]
Alexey Botchkov
made changes -
2017-08-08 07:03
issue.field.resolutiondate
2017-08-08 07:03:18.0
2017-08-08 07:03:18.797
Alexey Botchkov
made changes -
2017-08-08 07:03
Fix Version/s
10.2.7
[ 22543
]
Fix Version/s
10.2
[ 14601
]
Resolution
Fixed
[ 1
]
Status
In Progress
[ 3
]
Closed
[ 6
]
Alexey Botchkov
made changes -
2017-08-10 13:19
Fix Version/s
10.2.8
[ 22544
]
Fix Version/s
10.2.7
[ 22543
]
Sergei Golubchik
made changes -
2021-12-06 21:44
Workflow
MariaDB v3
[ 80491
]
MariaDB v4
[ 152026
]
{"report":{"fcp":1766.5,"ttfb":464.90000009536743,"pageVisibility":"visible","entityId":61081,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"bc41942c-ceab-47e5-8187-08afb89f0446","navigationType":0,"readyForUser":1852.2000000476837,"redirectCount":0,"resourceLoadedEnd":1468.0999999046326,"resourceLoadedStart":473.59999990463257,"resourceTiming":[{"duration":174.20000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":473.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":473.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":647.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":174.40000009536743,"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":473.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":473.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":648.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":786.1000001430511,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":474.09999990463257,"connectEnd":648.4000000953674,"connectStart":648.4000000953674,"domainLookupEnd":648.4000000953674,"domainLookupStart":648.4000000953674,"fetchStart":474.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":649.4000000953674,"responseEnd":1260.2000000476837,"responseStart":668.0999999046326,"secureConnectionStart":648.4000000953674},{"duration":928.5999999046326,"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":474.2000000476837,"connectEnd":474.2000000476837,"connectStart":474.2000000476837,"domainLookupEnd":474.2000000476837,"domainLookupStart":474.2000000476837,"fetchStart":474.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":649.9000000953674,"responseEnd":1402.7999999523163,"responseStart":672.0999999046326,"secureConnectionStart":474.2000000476837},{"duration":220.19999980926514,"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":474.40000009536743,"connectEnd":474.40000009536743,"connectStart":474.40000009536743,"domainLookupEnd":474.40000009536743,"domainLookupStart":474.40000009536743,"fetchStart":474.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":665.0999999046326,"responseEnd":694.5999999046326,"responseStart":680.7999999523163,"secureConnectionStart":474.40000009536743},{"duration":224,"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":474.59999990463257,"connectEnd":474.59999990463257,"connectStart":474.59999990463257,"domainLookupEnd":474.59999990463257,"domainLookupStart":474.59999990463257,"fetchStart":474.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":665.5,"responseEnd":698.5999999046326,"responseStart":694.9000000953674,"secureConnectionStart":474.59999990463257},{"duration":224.29999995231628,"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":474.7999999523163,"connectEnd":474.7999999523163,"connectStart":474.7999999523163,"domainLookupEnd":474.7999999523163,"domainLookupStart":474.7999999523163,"fetchStart":474.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":667.4000000953674,"responseEnd":699.0999999046326,"responseStart":696,"secureConnectionStart":474.7999999523163},{"duration":182.70000004768372,"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":475,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":475,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":657.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":224.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":475.09999990463257,"connectEnd":475.09999990463257,"connectStart":475.09999990463257,"domainLookupEnd":475.09999990463257,"domainLookupStart":475.09999990463257,"fetchStart":475.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":671.4000000953674,"responseEnd":699.4000000953674,"responseStart":696.7000000476837,"secureConnectionStart":475.09999990463257},{"duration":189.29999995231628,"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":475.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":475.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":664.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":224.79999995231628,"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":475.40000009536743,"connectEnd":475.40000009536743,"connectStart":475.40000009536743,"domainLookupEnd":475.40000009536743,"domainLookupStart":475.40000009536743,"fetchStart":475.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":671.7999999523163,"responseEnd":700.2000000476837,"responseStart":697.5,"secureConnectionStart":475.40000009536743},{"duration":986.2999999523163,"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":476.2000000476837,"connectEnd":476.2000000476837,"connectStart":476.2000000476837,"domainLookupEnd":476.2000000476837,"domainLookupStart":476.2000000476837,"fetchStart":476.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":949,"responseEnd":1462.5,"responseStart":1452.4000000953674,"secureConnectionStart":476.2000000476837},{"duration":986,"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":482.09999990463257,"connectEnd":482.09999990463257,"connectStart":482.09999990463257,"domainLookupEnd":482.09999990463257,"domainLookupStart":482.09999990463257,"fetchStart":482.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":1127.2000000476837,"responseEnd":1468.0999999046326,"responseStart":1455.5,"secureConnectionStart":482.09999990463257},{"duration":201.40000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1440,"connectEnd":1440,"connectStart":1440,"domainLookupEnd":1440,"domainLookupStart":1440,"fetchStart":1440,"redirectEnd":0,"redirectStart":0,"requestStart":1599.9000000953674,"responseEnd":1641.4000000953674,"responseStart":1640.5999999046326,"secureConnectionStart":1440},{"duration":234.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1706.2999999523163,"connectEnd":1706.2999999523163,"connectStart":1706.2999999523163,"domainLookupEnd":1706.2999999523163,"domainLookupStart":1706.2999999523163,"fetchStart":1706.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1905.0999999046326,"responseEnd":1941.2000000476837,"responseStart":1940.2999999523163,"secureConnectionStart":1706.2999999523163},{"duration":223.19999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1755.9000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1755.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1979.0999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":226,"responseStart":465,"responseEnd":474,"domLoading":471,"domInteractive":1982,"domContentLoadedEventStart":1982,"domContentLoadedEventEnd":2045,"domComplete":2508,"loadEventStart":2508,"loadEventEnd":2508,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1931.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1932.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":1932.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1937.2999999523163},{"name":"activityTabFullyLoaded","time":2065.2999999523163}],"measures":[],"correlationId":"41ce048ec37a43","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":162,"dbReadsTimeInMs":28,"dbConnsTimeInMs":44,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I'm not quite sure which logic is correct here.
On one hand, if we just run JSON_EXTRACT (on either of the servers), the result is obviously different from 'value':
| @@version |
| 5.7.17-debug |
On the other hand, it's reasonable to expect that quote marks are not taken into account.
It would be great if standard specified which behavior is correct, but I don't know whether it does. Leaving to holyfoot to decide what to do about it.