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
0e63023c
Commit
0e63023c
authored
Mar 15, 2022
by
Alexander Barkov
Committed by
Daniel Black
Mar 16, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 10.2 into 10.3
parents
a9500860
03c3dc63
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
129 additions
and
0 deletions
+129
-0
mysql-test/main/ctype_utf32.result
mysql-test/main/ctype_utf32.result
+23
-0
mysql-test/main/ctype_utf32.test
mysql-test/main/ctype_utf32.test
+19
-0
mysql-test/main/ctype_utf32_uca.result
mysql-test/main/ctype_utf32_uca.result
+15
-0
mysql-test/main/ctype_utf32_uca.test
mysql-test/main/ctype_utf32_uca.test
+13
-0
mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
+3
-0
sql/sql_class.cc
sql/sql_class.cc
+52
-0
sql/sql_class.h
sql/sql_class.h
+4
-0
No files found.
mysql-test/main/ctype_utf32.result
View file @
0e63023c
...
...
@@ -2890,5 +2890,28 @@ HEX(c1)
0000006100000063
DROP TABLE t1;
#
# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
#
CREATE TABLE t1 (a CHAR(1));
SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary;
ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
ERROR HY000: Column 'a' has duplicated value 'a' in ENUM
ALTER TABLE t1 CHANGE a a ENUM('aaa') CHARACTER SET utf32;
ERROR HY000: Invalid utf32 character string: '\x00aaa'
ALTER TABLE t1 CHANGE a a ENUM('aa') CHARACTER SET utf32;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('慡') CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a','b') CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#
mysql-test/main/ctype_utf32.test
View file @
0e63023c
...
...
@@ -1048,6 +1048,25 @@ INSERT INTO t1 (c1) VALUES (1),(2),(3);
SELECT
HEX
(
c1
)
FROM
t1
ORDER
BY
c1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
--
echo
#
CREATE
TABLE
t1
(
a
CHAR
(
1
));
SET
COLLATION_CONNECTION
=
utf32_general_ci
,
CHARACTER_SET_CLIENT
=
binary
;
--
error
ER_DUPLICATED_VALUE_IN_TYPE
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'a'
,
'a'
)
CHARACTER
SET
utf32
;
--
error
ER_INVALID_CHARACTER_STRING
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'aaa'
)
CHARACTER
SET
utf32
;
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'aa'
)
CHARACTER
SET
utf32
;
SHOW
CREATE
TABLE
t1
;
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'a'
,
'b'
)
CHARACTER
SET
utf32
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
SET
NAMES
utf8
;
--
echo
#
--
echo
# End of 10.2 tests
--
echo
#
mysql-test/main/ctype_utf32_uca.result
View file @
0e63023c
...
...
@@ -7941,5 +7941,20 @@ EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;
#
# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
#
CREATE TABLE t1 (a CHAR(1));
SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary;
ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
ERROR HY000: Column 'a' has duplicated value 'a' in ENUM
ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a','b') CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#
mysql-test/main/ctype_utf32_uca.test
View file @
0e63023c
...
...
@@ -290,6 +290,19 @@ EXECUTE s;
DEALLOCATE
PREPARE
s
;
SET
NAMES
utf8
;
--
echo
#
--
echo
# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
--
echo
#
CREATE
TABLE
t1
(
a
CHAR
(
1
));
SET
COLLATION_CONNECTION
=
utf32_myanmar_ci
,
CHARACTER_SET_CLIENT
=
binary
;
--
error
ER_DUPLICATED_VALUE_IN_TYPE
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'a'
,
'a'
)
CHARACTER
SET
utf32
;
ALTER
TABLE
t1
CHANGE
a
a
ENUM
(
'a'
,
'b'
)
CHARACTER
SET
utf32
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
SET
NAMES
utf8
;
--
echo
#
--
echo
# End of 10.2 tests
...
...
mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
View file @
0e63023c
...
...
@@ -12,6 +12,9 @@
# Change Date: #
# Change: #
################################################################################
--
source
include
/
have_des
.
inc
set
time_zone
=
"+03:00"
;
--
echo
#
--
echo
# NUMERIC FUNCTIONS
...
...
sql/sql_class.cc
View file @
0e63023c
...
...
@@ -2306,6 +2306,58 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
}
/*
Reinterpret a binary string to a character string
@param[OUT] to The result will be written here,
either the original string as is,
or a newly alloced fixed string with
some zero bytes prepended.
@param cs The destination character set
@param str The binary string
@param length The length of the binary string
@return false on success
@return true on error
*/
bool
THD
::
reinterpret_string_from_binary
(
LEX_CSTRING
*
to
,
CHARSET_INFO
*
cs
,
const
char
*
str
,
size_t
length
)
{
/*
When reinterpreting from binary to tricky character sets like
UCS2, UTF16, UTF32, we may need to prepend some zero bytes.
This is possible in scenarios like this:
SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary;
This code is similar to String::copy_aligned().
*/
size_t
incomplete
=
length
%
cs
->
mbminlen
;
// Bytes in an incomplete character
if
(
incomplete
)
{
size_t
zeros
=
cs
->
mbminlen
-
incomplete
;
size_t
aligned_length
=
zeros
+
length
;
char
*
dst
=
(
char
*
)
alloc
(
aligned_length
+
1
);
if
(
!
dst
)
{
to
->
str
=
NULL
;
// Safety
to
->
length
=
0
;
return
true
;
}
bzero
(
dst
,
zeros
);
memcpy
(
dst
+
zeros
,
str
,
length
);
dst
[
aligned_length
]
=
'\0'
;
to
->
str
=
dst
;
to
->
length
=
aligned_length
;
}
else
{
to
->
str
=
str
;
to
->
length
=
length
;
}
return
check_string_for_wellformedness
(
to
->
str
,
to
->
length
,
cs
);
}
/*
Convert a string between two character sets.
dstcs and srccs cannot be &my_charset_bin.
...
...
sql/sql_class.h
View file @
0e63023c
...
...
@@ -3717,6 +3717,8 @@ class THD :public Statement,
bool
convert_string
(
LEX_STRING
*
to
,
CHARSET_INFO
*
to_cs
,
const
char
*
from
,
size_t
from_length
,
CHARSET_INFO
*
from_cs
);
bool
reinterpret_string_from_binary
(
LEX_CSTRING
*
to
,
CHARSET_INFO
*
to_cs
,
const
char
*
from
,
size_t
from_length
);
bool
convert_string
(
LEX_CSTRING
*
to
,
CHARSET_INFO
*
to_cs
,
const
char
*
from
,
size_t
from_length
,
CHARSET_INFO
*
from_cs
)
...
...
@@ -3733,6 +3735,8 @@ class THD :public Statement,
{
if
(
!
simple_copy_is_possible
)
return
unlikely
(
convert_string
(
to
,
tocs
,
from
->
str
,
from
->
length
,
fromcs
));
if
(
fromcs
==
&
my_charset_bin
)
return
reinterpret_string_from_binary
(
to
,
tocs
,
from
->
str
,
from
->
length
);
*
to
=
*
from
;
return
false
;
}
...
...
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