mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
This commit is contained in:
parent
5cae401b00
commit
bb200599ff
5 changed files with 73 additions and 2 deletions
|
@ -6473,5 +6473,24 @@ CAST(_ucs2 0x0061E0030062 AS INT)
|
|||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'ab'
|
||||
#
|
||||
# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
|
||||
#
|
||||
SET NAMES utf8, collation_connection=ucs2_general_ci;
|
||||
SELECT 1 COLLATE ucs2_general_ci;
|
||||
1 COLLATE ucs2_general_ci
|
||||
1
|
||||
SELECT 1 COLLATE ucs2_bin;
|
||||
1 COLLATE ucs2_bin
|
||||
1
|
||||
SELECT HEX(1 COLLATE ucs2_general_ci);
|
||||
HEX(1 COLLATE ucs2_general_ci)
|
||||
0031
|
||||
SELECT HEX(1 COLLATE ucs2_bin);
|
||||
HEX(1 COLLATE ucs2_bin)
|
||||
0031
|
||||
SELECT 1 COLLATE latin1_swedish_ci;
|
||||
ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'ucs2'
|
||||
SET NAMES utf8;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -1146,6 +1146,19 @@ SELECT CAST(_ucs2 0x0061DFFF0062 AS INT);
|
|||
SELECT CAST(_ucs2 0x0061D7000062 AS INT);
|
||||
SELECT CAST(_ucs2 0x0061E0030062 AS INT);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
|
||||
--echo #
|
||||
|
||||
SET NAMES utf8, collation_connection=ucs2_general_ci;
|
||||
SELECT 1 COLLATE ucs2_general_ci;
|
||||
SELECT 1 COLLATE ucs2_bin;
|
||||
SELECT HEX(1 COLLATE ucs2_general_ci);
|
||||
SELECT HEX(1 COLLATE ucs2_bin);
|
||||
--error ER_COLLATION_CHARSET_MISMATCH
|
||||
SELECT 1 COLLATE latin1_swedish_ci;
|
||||
SET NAMES utf8;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -4149,3 +4149,21 @@ c
|
|||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
|
||||
#
|
||||
SET NAMES utf8mb4;
|
||||
SELECT 1 COLLATE utf8mb4_general_ci;
|
||||
1 COLLATE utf8mb4_general_ci
|
||||
1
|
||||
SELECT 1 COLLATE utf8mb4_bin;
|
||||
1 COLLATE utf8mb4_bin
|
||||
1
|
||||
SELECT 1 COLLATE latin1_swedish_ci;
|
||||
ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -2043,3 +2043,22 @@ EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
|
|||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
|
||||
--echo #
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SELECT 1 COLLATE utf8mb4_general_ci;
|
||||
SELECT 1 COLLATE utf8mb4_bin;
|
||||
--error ER_COLLATION_CHARSET_MISMATCH
|
||||
SELECT 1 COLLATE latin1_swedish_ci;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -3552,10 +3552,12 @@ String *Item_func_set_collation::val_str(String *str)
|
|||
|
||||
bool Item_func_set_collation::fix_length_and_dec()
|
||||
{
|
||||
if (!my_charset_same(args[0]->collation.collation, m_set_collation))
|
||||
if (agg_arg_charsets_for_string_result(collation, args, 1))
|
||||
return true;
|
||||
if (!my_charset_same(collation.collation, m_set_collation))
|
||||
{
|
||||
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
|
||||
m_set_collation->name, args[0]->collation.collation->csname);
|
||||
m_set_collation->name, collation.collation->csname);
|
||||
return TRUE;
|
||||
}
|
||||
collation.set(m_set_collation, DERIVATION_EXPLICIT,
|
||||
|
|
Loading…
Add table
Reference in a new issue