mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16869 String functions don't respect character set of JSON_VALUE.
Item_func_json_value::val_str() produced string of wrong charset.
This commit is contained in:
@ -766,3 +766,15 @@ DROP TABLE t1;
|
||||
select json_array(1,uuid(),compress(5.140264e+307));
|
||||
json_array(1,uuid(),compress(5.140264e+307))
|
||||
NULL
|
||||
#
|
||||
# MDEV-16869 String functions don't respect character set of JSON_VALUE.
|
||||
#
|
||||
create table t1(json_col TEXT) DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
|
||||
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
|
||||
JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC'
|
||||
1
|
||||
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
|
||||
REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC'
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -429,3 +429,14 @@ DROP TABLE t1;
|
||||
|
||||
select json_array(1,uuid(),compress(5.140264e+307));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16869 String functions don't respect character set of JSON_VALUE.
|
||||
--echo #
|
||||
|
||||
create table t1(json_col TEXT) DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
|
||||
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
|
||||
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -479,7 +479,7 @@ String *Item_func_json_value::val_str(String *str)
|
||||
(const uchar *) js->ptr() + js->length());
|
||||
|
||||
str->length(0);
|
||||
str->set_charset(&my_charset_utf8mb4_bin);
|
||||
str->set_charset(collation.collation);
|
||||
|
||||
path.cur_step= path.p.steps;
|
||||
continue_search:
|
||||
|
Reference in New Issue
Block a user