Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6352ec21
Commit
6352ec21
authored
Sep 12, 2017
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12982 JSON_EXTRACT returns data for invalid JSON.
Let's check the validity to the end of the JSON.
parent
31774f0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
mysql-test/r/func_json.result
mysql-test/r/func_json.result
+5
-0
mysql-test/t/func_json.test
mysql-test/t/func_json.test
+5
-0
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+4
-0
No files found.
mysql-test/r/func_json.result
View file @
6352ec21
...
...
@@ -669,3 +669,8 @@ JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"')
"\u00f6"
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo')
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 15
mysql-test/t/func_json.test
View file @
6352ec21
...
...
@@ -317,3 +317,8 @@ select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
select
JSON_EXTRACT
(
'{\"asdf\":true}'
,
"$.
\"
asdf
\"
"
)
=
1
;
select
JSON_EXTRACT
(
'{\"input1\":\"\\u00f6\"}'
,
'$.\"input1\"'
);
#
# MDEV-129892 JSON_EXTRACT returns data for invalid JSON
#
select
JSON_EXTRACT
(
'{"foo": "bar" foobar foo invalid '
,
'$.foo'
);
sql/item_jsonfunc.cc
View file @
6352ec21
...
...
@@ -821,7 +821,11 @@ String *Item_func_json_extract::read_json(String *str,
not_first_value
=
1
;
if
(
!
possible_multiple_values
)
{
/* Loop to the end of the JSON just to make sure it's valid. */
while
(
json_get_path_next
(
&
je
,
&
p
)
==
0
)
{}
break
;
}
}
if
(
je
.
s
.
error
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment