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
e290e5a7
Commit
e290e5a7
authored
Jun 15, 2020
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22837 JSON_ARRAYAGG and JSON_OBJECTAGG treat JSON arguments as text.
Item_field::is_json_value() implemented.
parent
6c573a91
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
1 deletion
+27
-1
mysql-test/main/func_json.result
mysql-test/main/func_json.result
+7
-0
mysql-test/main/func_json.test
mysql-test/main/func_json.test
+6
-0
sql/item.cc
sql/item.cc
+11
-0
sql/item.h
sql/item.h
+1
-0
sql/item_func.h
sql/item_func.h
+1
-1
sql/item_jsonfunc.h
sql/item_jsonfunc.h
+1
-0
No files found.
mysql-test/main/func_json.result
View file @
e290e5a7
...
...
@@ -1320,6 +1320,13 @@ Warnings:
Warning 1260 Row 1 was cut by JSON_ARRAYAGG()
drop table t1;
SET group_concat_max_len= default;
create table t1 (col1 json);
insert into t1 values('{"color":"red", "size":1}' );
insert into t1 values('{"color":"blue", "size":2}' );
select JSON_ARRAYAGG(col1) from t1;
JSON_ARRAYAGG(col1)
[{"color":"red", "size":1},{"color":"blue", "size":2}]
drop table t1;
#
# End of 10.5 tests
#
mysql-test/main/func_json.test
View file @
e290e5a7
...
...
@@ -820,6 +820,12 @@ select json_arrayagg(a) from t1;
drop
table
t1
;
SET
group_concat_max_len
=
default
;
create
table
t1
(
col1
json
);
insert
into
t1
values
(
'{"color":"red", "size":1}'
);
insert
into
t1
values
(
'{"color":"blue", "size":2}'
);
select
JSON_ARRAYAGG
(
col1
)
from
t1
;
drop
table
t1
;
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
...
...
sql/item.cc
View file @
e290e5a7
...
...
@@ -3052,6 +3052,17 @@ Item_field::Item_field(THD *thd, Item_field *item)
}
bool
Item_field
::
is_json_type
()
{
if
(
!
field
->
check_constraint
||
field
->
check_constraint
->
expr
->
type
()
!=
FUNC_ITEM
)
return
FALSE
;
Item_func
*
f
=
(
Item_func
*
)
field
->
check_constraint
->
expr
;
return
f
->
functype
()
==
Item_func
::
JSON_VALID_FUNC
;
}
void
Item_field
::
set_field
(
Field
*
field_par
)
{
field
=
result_field
=
field_par
;
// for easy coding with fields
...
...
sql/item.h
View file @
e290e5a7
...
...
@@ -3389,6 +3389,7 @@ class Item_field :public Item_ident,
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
val_bool_result
();
bool
is_null_result
();
bool
is_json_type
();
bool
send
(
Protocol
*
protocol
,
st_value
*
buffer
);
Load_data_outvar
*
get_load_data_outvar
()
{
...
...
sql/item_func.h
View file @
e290e5a7
...
...
@@ -76,7 +76,7 @@ class Item_func :public Item_func_or_sum,
SUSERVAR_FUNC
,
GUSERVAR_FUNC
,
COLLATE_FUNC
,
EXTRACT_FUNC
,
CHAR_TYPECAST_FUNC
,
FUNC_SP
,
UDF_FUNC
,
NEG_FUNC
,
GSYSVAR_FUNC
,
IN_OPTIMIZER_FUNC
,
DYNCOL_FUNC
,
JSON_EXTRACT_FUNC
,
JSON_EXTRACT_FUNC
,
JSON_VALID_FUNC
,
CASE_SEARCHED_FUNC
,
// Used by ColumnStore/Spider
CASE_SIMPLE_FUNC
// Used by ColumnStore/spider
};
...
...
sql/item_jsonfunc.h
View file @
e290e5a7
...
...
@@ -91,6 +91,7 @@ class Item_func_json_valid: public Item_bool_func
}
Item
*
get_copy
(
THD
*
thd
)
{
return
get_item_copy
<
Item_func_json_valid
>
(
thd
,
this
);
}
enum
Functype
functype
()
const
{
return
JSON_VALID_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