File tree Expand file tree Collapse file tree 5 files changed +73
-2
lines changed Expand file tree Collapse file tree 5 files changed +73
-2
lines changed Original file line number Diff line number Diff line change @@ -6473,5 +6473,24 @@ CAST(_ucs2 0x0061E0030062 AS INT)
6473
6473
Warnings:
6474
6474
Warning 1292 Truncated incorrect INTEGER value: 'ab'
6475
6475
#
6476
+ # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
6477
+ #
6478
+ SET NAMES utf8, collation_connection=ucs2_general_ci;
6479
+ SELECT 1 COLLATE ucs2_general_ci;
6480
+ 1 COLLATE ucs2_general_ci
6481
+ 1
6482
+ SELECT 1 COLLATE ucs2_bin;
6483
+ 1 COLLATE ucs2_bin
6484
+ 1
6485
+ SELECT HEX(1 COLLATE ucs2_general_ci);
6486
+ HEX(1 COLLATE ucs2_general_ci)
6487
+ 0031
6488
+ SELECT HEX(1 COLLATE ucs2_bin);
6489
+ HEX(1 COLLATE ucs2_bin)
6490
+ 0031
6491
+ SELECT 1 COLLATE latin1_swedish_ci;
6492
+ ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'ucs2'
6493
+ SET NAMES utf8;
6494
+ #
6476
6495
# End of 10.5 tests
6477
6496
#
Original file line number Diff line number Diff line change @@ -1146,6 +1146,19 @@ SELECT CAST(_ucs2 0x0061DFFF0062 AS INT);
1146
1146
SELECT CAST(_ucs2 0x0061D7000062 AS INT);
1147
1147
SELECT CAST(_ucs2 0x0061E0030062 AS INT);
1148
1148
1149
+ --echo #
1150
+ --echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
1151
+ --echo #
1152
+
1153
+ SET NAMES utf8, collation_connection=ucs2_general_ci;
1154
+ SELECT 1 COLLATE ucs2_general_ci;
1155
+ SELECT 1 COLLATE ucs2_bin;
1156
+ SELECT HEX(1 COLLATE ucs2_general_ci);
1157
+ SELECT HEX(1 COLLATE ucs2_bin);
1158
+ --error ER_COLLATION_CHARSET_MISMATCH
1159
+ SELECT 1 COLLATE latin1_swedish_ci;
1160
+ SET NAMES utf8;
1161
+
1149
1162
--echo #
1150
1163
--echo # End of 10.5 tests
1151
1164
--echo #
Original file line number Diff line number Diff line change 4149
4149
#
4150
4150
# End of 10.2 tests
4151
4151
#
4152
+ #
4153
+ # Start of 10.5 tests
4154
+ #
4155
+ #
4156
+ # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
4157
+ #
4158
+ SET NAMES utf8mb4;
4159
+ SELECT 1 COLLATE utf8mb4_general_ci;
4160
+ 1 COLLATE utf8mb4_general_ci
4161
+ 1
4162
+ SELECT 1 COLLATE utf8mb4_bin;
4163
+ 1 COLLATE utf8mb4_bin
4164
+ 1
4165
+ SELECT 1 COLLATE latin1_swedish_ci;
4166
+ ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
4167
+ #
4168
+ # End of 10.5 tests
4169
+ #
Original file line number Diff line number Diff line change @@ -2043,3 +2043,22 @@ EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
2043
2043
--echo #
2044
2044
--echo # End of 10.2 tests
2045
2045
--echo #
2046
+
2047
+
2048
+ --echo #
2049
+ --echo # Start of 10.5 tests
2050
+ --echo #
2051
+
2052
+ --echo #
2053
+ --echo # MDEV-24584 Selecting INT column with COLLATE utf8mb4_general_ci throws an error
2054
+ --echo #
2055
+
2056
+ SET NAMES utf8mb4;
2057
+ SELECT 1 COLLATE utf8mb4_general_ci;
2058
+ SELECT 1 COLLATE utf8mb4_bin;
2059
+ --error ER_COLLATION_CHARSET_MISMATCH
2060
+ SELECT 1 COLLATE latin1_swedish_ci;
2061
+
2062
+ --echo #
2063
+ --echo # End of 10.5 tests
2064
+ --echo #
Original file line number Diff line number Diff line change @@ -3552,10 +3552,12 @@ String *Item_func_set_collation::val_str(String *str)
3552
3552
3553
3553
bool Item_func_set_collation::fix_length_and_dec ()
3554
3554
{
3555
- if (!my_charset_same (args[0 ]->collation .collation , m_set_collation))
3555
+ if (agg_arg_charsets_for_string_result (collation, args, 1 ))
3556
+ return true ;
3557
+ if (!my_charset_same (collation.collation , m_set_collation))
3556
3558
{
3557
3559
my_error (ER_COLLATION_CHARSET_MISMATCH, MYF (0 ),
3558
- m_set_collation->name , args[ 0 ]-> collation .collation ->csname );
3560
+ m_set_collation->name , collation.collation ->csname );
3559
3561
return TRUE ;
3560
3562
}
3561
3563
collation.set (m_set_collation, DERIVATION_EXPLICIT,
You can’t perform that action at this time.
0 commit comments