mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-33318 ORDER BY COLLATE improperly applied to non-character columns
when changing charset from latin1 to utf8, adjust max_length accordingly
This commit is contained in:
parent
67abdb9f33
commit
7828aadd3a
3 changed files with 42 additions and 1 deletions
|
@ -772,3 +772,27 @@ string
|
|||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-33318 ORDER BY COLLATE improperly applied to non-character columns
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (ts datetime);
|
||||
insert t1 values ('2024-01-26 21:37:54'), ('2024-01-26 21:37:54'),
|
||||
('2024-01-26 21:37:54'), ('2024-01-26 21:37:54'),
|
||||
('2024-01-26 21:37:58'), ('2024-01-26 21:37:58'),
|
||||
('2024-01-26 21:37:58'), ('2024-01-26 21:38:02'),
|
||||
('2024-01-26 21:38:02'), ('2024-01-26 21:38:02');
|
||||
select * from t1 order by ts collate utf8_bin;
|
||||
ts
|
||||
2024-01-26 21:37:54
|
||||
2024-01-26 21:37:54
|
||||
2024-01-26 21:37:54
|
||||
2024-01-26 21:37:54
|
||||
2024-01-26 21:37:58
|
||||
2024-01-26 21:37:58
|
||||
2024-01-26 21:37:58
|
||||
2024-01-26 21:38:02
|
||||
2024-01-26 21:38:02
|
||||
2024-01-26 21:38:02
|
||||
drop table t1;
|
||||
# End of 10.6 tests
|
||||
|
|
|
@ -357,3 +357,18 @@ SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLL
|
|||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33318 ORDER BY COLLATE improperly applied to non-character columns
|
||||
--echo #
|
||||
set names utf8;
|
||||
create table t1 (ts datetime);
|
||||
insert t1 values ('2024-01-26 21:37:54'), ('2024-01-26 21:37:54'),
|
||||
('2024-01-26 21:37:54'), ('2024-01-26 21:37:54'),
|
||||
('2024-01-26 21:37:58'), ('2024-01-26 21:37:58'),
|
||||
('2024-01-26 21:37:58'), ('2024-01-26 21:38:02'),
|
||||
('2024-01-26 21:38:02'), ('2024-01-26 21:38:02');
|
||||
select * from t1 order by ts collate utf8_bin;
|
||||
drop table t1;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
|
|
@ -3590,7 +3590,9 @@ bool Item_func_set_collation::fix_length_and_dec()
|
|||
}
|
||||
collation.set(m_set_collation, DERIVATION_EXPLICIT,
|
||||
args[0]->collation.repertoire);
|
||||
max_length= args[0]->max_length;
|
||||
ulonglong max_char_length= (ulonglong) args[0]->max_char_length();
|
||||
fix_char_length_ulonglong(max_char_length * collation.collation->mbmaxlen);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue