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
0ead2031
Commit
0ead2031
authored
Nov 21, 2023
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.5 into 10.6
parents
cd04673a
9b7a1c0e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
65 deletions
+57
-65
mysql-test/main/func_json.result
mysql-test/main/func_json.result
+11
-0
mysql-test/main/func_json.test
mysql-test/main/func_json.test
+10
-0
sql/field.cc
sql/field.cc
+0
-58
sql/field.h
sql/field.h
+28
-7
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+7
-0
sql/item_jsonfunc.h
sql/item_jsonfunc.h
+1
-0
No files found.
mysql-test/main/func_json.result
View file @
0ead2031
...
...
@@ -1646,6 +1646,17 @@ SELECT JSON_OBJECTAGG('\\', 1);
JSON_OBJECTAGG('\\', 1)
{"\\":1}
#
# MDEV-24784 JSON_ARRAYAGG charset issue
#
set names utf8;
select json_arrayagg('ä'), json_objectagg(1, 'ä');
json_arrayagg('ä') json_objectagg(1, 'ä')
["ä"] {"1":"ä"}
set names latin1;
select json_arrayagg('ä'), json_objectagg(1, 'ä');
json_arrayagg('ä') json_objectagg(1, 'ä')
["ä"] {"1":"ä"}
#
# End of 10.5 tests
#
#
...
...
mysql-test/main/func_json.test
View file @
0ead2031
...
...
@@ -1111,6 +1111,16 @@ SELECT JSON_OBJECTAGG('"', 1);
SELECT
JSON_OBJECTAGG
(
'\"'
,
1
);
SELECT
JSON_OBJECTAGG
(
'\\'
,
1
);
--
echo
#
--
echo
# MDEV-24784 JSON_ARRAYAGG charset issue
--
echo
#
--
disable_service_connection
set
names
utf8
;
select
json_arrayagg
(
'ä'
),
json_objectagg
(
1
,
'ä'
);
set
names
latin1
;
select
json_arrayagg
(
'ä'
),
json_objectagg
(
1
,
'ä'
);
--
enable_service_connection
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
...
...
sql/field.cc
View file @
0ead2031
...
...
@@ -4689,30 +4689,6 @@ bool Field_longlong::is_max()
single precision float
****************************************************************************/
Field_float
::
Field_float
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
)
:
Field_real
(
ptr_arg
,
len_arg
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
(
dec_arg
>=
FLOATING_POINT_DECIMALS
?
NOT_FIXED_DEC
:
dec_arg
),
zero_arg
,
unsigned_arg
)
{
}
Field_float
::
Field_float
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
(
dec_arg
>=
FLOATING_POINT_DECIMALS
?
NOT_FIXED_DEC
:
dec_arg
),
0
,
0
)
{
}
int
Field_float
::
store
(
const
char
*
from
,
size_t
len
,
CHARSET_INFO
*
cs
)
{
int
error
;
...
...
@@ -4861,40 +4837,6 @@ Binlog_type_info Field_float::binlog_type_info() const
double precision floating point numbers
****************************************************************************/
Field_double
::
Field_double
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
)
:
Field_real
(
ptr_arg
,
len_arg
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
(
dec_arg
>=
FLOATING_POINT_DECIMALS
?
NOT_FIXED_DEC
:
dec_arg
),
zero_arg
,
unsigned_arg
)
{
}
Field_double
::
Field_double
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
(
dec_arg
>=
FLOATING_POINT_DECIMALS
?
NOT_FIXED_DEC
:
dec_arg
),
0
,
0
)
{
}
Field_double
::
Field_double
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
not_fixed_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
(
dec_arg
>=
FLOATING_POINT_DECIMALS
?
NOT_FIXED_DEC
:
dec_arg
),
0
,
0
)
{
not_fixed
=
not_fixed_arg
;
}
int
Field_double
::
store
(
const
char
*
from
,
size_t
len
,
CHARSET_INFO
*
cs
)
{
int
error
;
...
...
sql/field.h
View file @
0ead2031
...
...
@@ -2121,7 +2121,7 @@ class Field_str :public Field {
const
LEX_CSTRING
*
field_name_arg
,
const
DTCollation
&
collation
);
decimal_digits_t
decimals
()
const
override
{
return
is_created_from_null_item
?
0
:
NOT_FIXED_DEC
;
}
{
return
is_created_from_null_item
?
0
:
DECIMAL_NOT_SPECIFIED
;
}
int
save_in_field
(
Field
*
to
)
override
{
return
save_in_field_str
(
to
);
}
bool
memcpy_field_possible
(
const
Field
*
from
)
const
override
{
...
...
@@ -2289,7 +2289,7 @@ class Field_real :public Field_num {
Information_schema_numeric_attributes
information_schema_numeric_attributes
()
const
override
{
return
dec
==
NOT_FIXED_DEC
?
return
dec
==
DECIMAL_NOT_SPECIFIED
?
Information_schema_numeric_attributes
(
field_length
)
:
Information_schema_numeric_attributes
(
field_length
,
dec
);
}
...
...
@@ -2861,15 +2861,24 @@ class Field_vers_trx_id :public Field_longlong {
integers. But in all other cases we treat it as TIME_RESULT! */
};
static
inline
decimal_digits_t
fix_dec_arg
(
decimal_digits_t
dec_arg
)
{
return
dec_arg
>=
FLOATING_POINT_DECIMALS
?
DECIMAL_NOT_SPECIFIED
:
dec_arg
;
}
class
Field_float
final
:
public
Field_real
{
public:
Field_float
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
);
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
)
:
Field_real
(
ptr_arg
,
len_arg
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
fix_dec_arg
(
dec_arg
),
zero_arg
,
unsigned_arg
)
{
}
Field_float
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
);
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
fix_dec_arg
(
dec_arg
),
0
,
0
)
{
}
const
Type_handler
*
type_handler
()
const
override
{
return
&
type_handler_float
;
}
enum
ha_base_keytype
key_type
()
const
override
{
return
HA_KEYTYPE_FLOAT
;
}
...
...
@@ -2902,12 +2911,24 @@ class Field_double :public Field_real {
Field_double
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
);
decimal_digits_t
dec_arg
,
bool
zero_arg
,
bool
unsigned_arg
)
:
Field_real
(
ptr_arg
,
len_arg
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
fix_dec_arg
(
dec_arg
),
zero_arg
,
unsigned_arg
)
{
}
Field_double
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
);
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
fix_dec_arg
(
dec_arg
),
0
,
0
)
{
}
Field_double
(
uint32
len_arg
,
bool
maybe_null_arg
,
const
LEX_CSTRING
*
field_name_arg
,
decimal_digits_t
dec_arg
,
bool
not_fixed_arg
);
decimal_digits_t
dec_arg
,
bool
not_fixed_arg
)
:
Field_real
((
uchar
*
)
0
,
len_arg
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
(
uint
)
0
,
NONE
,
field_name_arg
,
fix_dec_arg
(
dec_arg
),
0
,
0
)
{
not_fixed
=
not_fixed_arg
;
}
void
init_for_tmp_table
(
Field
*
org_field
,
TABLE
*
new_table
)
override
{
Field
::
init_for_tmp_table
(
org_field
,
new_table
);
...
...
sql/item_jsonfunc.cc
View file @
0ead2031
...
...
@@ -3932,6 +3932,13 @@ int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
return
MY_TEST
(
sortcmp
(
res1
,
res2
,
compare_collation
())
==
0
);
}
bool
Item_func_json_arrayagg
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
{
bool
res
=
Item_func_group_concat
::
fix_fields
(
thd
,
ref
);
m_tmp_json
.
set_charset
(
collation
.
collation
);
return
res
;
}
String
*
Item_func_json_arrayagg
::
get_str_from_item
(
Item
*
i
,
String
*
tmp
)
{
...
...
sql/item_jsonfunc.h
View file @
0ead2031
...
...
@@ -669,6 +669,7 @@ class Item_func_json_arrayagg : public Item_func_group_concat
static
LEX_CSTRING
name
=
{
STRING_WITH_LEN
(
"json_arrayagg("
)
};
return
name
;
}
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
)
override
;
enum
Sumfunctype
sum_func
()
const
override
{
return
JSON_ARRAYAGG_FUNC
;
}
String
*
val_str
(
String
*
str
)
override
;
...
...
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