mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Row comparison now does compare field collations, e.g.
ROW('a','b','c) = ROW('A' collate latin1_bin,'b','c') returns 0
When a number is compared to a string, character sets and
collations are not aggregated. e.g. this returned error in 4.1.0:
SELECT 1=_latin2'1';
because character sets was aggregated, and 1 was considered as
a string of latin1 charset during this aggregation.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
set names latin1;
|
||||
|
||||
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
|
||||
select 'hello' 'monty';
|
||||
select length('\n\t\r\b\0\_\%\\');
|
||||
@@ -136,6 +138,21 @@ DROP TABLE t1;
|
||||
#
|
||||
# Test collation and coercibility
|
||||
#
|
||||
|
||||
select 1=_latin1'1';
|
||||
select _latin1'1'=1;
|
||||
select _latin2'1'=1;
|
||||
select 1=_latin2'1';
|
||||
--error 1265
|
||||
select _latin1'1'=_latin2'1';
|
||||
select row('a','b','c') = row('a','b','c');
|
||||
select row('A','b','c') = row('a','b','c');
|
||||
select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
|
||||
select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
--error 1265
|
||||
select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
|
||||
|
||||
select POSITION(_latin1'B' IN _latin1'abcd');
|
||||
select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
|
||||
select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
|
||||
|
||||
Reference in New Issue
Block a user