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
54545005
Commit
54545005
authored
Dec 05, 2016
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-11452 JSON_CONTAINS accepts wrong number of arguments.
Create_func_json_contains::create_native fixed.
parent
c89c514e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
mysql-test/r/func_json.result
mysql-test/r/func_json.result
+2
-0
mysql-test/t/func_json.test
mysql-test/t/func_json.test
+2
-0
sql/item_create.cc
sql/item_create.cc
+3
-3
No files found.
mysql-test/r/func_json.result
View file @
54545005
...
...
@@ -76,6 +76,8 @@ json_contains('"you"', '"you"')
select json_contains('"youth"', '"you"');
json_contains('"youth"', '"you"')
0
select json_contains('[1]', '[1]', '$', '$[0]');
ERROR 42000: Incorrect parameter count in the call to native function 'json_contains'
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
1
...
...
mysql-test/t/func_json.test
View file @
54545005
...
...
@@ -30,6 +30,8 @@ SELECT JSON_ARRAY_INSERT('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
select
json_contains
(
'{"k1":123, "k2":345}'
,
'123'
,
'$.k1'
);
select
json_contains
(
'"you"'
,
'"you"'
);
select
json_contains
(
'"youth"'
,
'"you"'
);
--
error
ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select
json_contains
(
'[1]'
,
'[1]'
,
'$'
,
'$[0]'
);
select
json_contains_path
(
'{"key1":1, "key2":[2,3]}'
,
"oNE"
,
"$.key2[1]"
);
select
json_contains_path
(
'{"key1":1, "key2":[2,3]}'
,
"oNE"
,
"$.key2[10]"
);
...
...
sql/item_create.cc
View file @
54545005
...
...
@@ -5218,13 +5218,13 @@ Create_func_json_contains::create_native(THD *thd, LEX_STRING name,
if
(
item_list
!=
NULL
)
arg_count
=
item_list
->
elements
;
if
(
arg_count
<
2
/* json_doc, val, [path]...
*/
)
if
(
arg_count
==
2
||
arg_count
==
3
/* json_doc, val, [path]
*/
)
{
my_error
(
ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
,
MYF
(
0
),
name
.
str
);
func
=
new
(
thd
->
mem_root
)
Item_func_json_contains
(
thd
,
*
item_list
);
}
else
{
func
=
new
(
thd
->
mem_root
)
Item_func_json_contains
(
thd
,
*
item_list
);
my_error
(
ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
,
MYF
(
0
),
name
.
str
);
}
return
func
;
...
...
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