[MDEV-29290] Hex value instead char in definition of view gives incorrect result Created: 2022-08-11  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.11

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: view-protocol

Attachments: File vv.frm    
Issue Links:
PartOf
is part of MDEV-27691 make working view-protocol Open

 Description   

Expected that "select" and "view" give the same result:
Test:

set collation_connection=ucs2_unicode_ci;
select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
 
create view vv as select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
select * from vv;
drop view vv;

Actual result

select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))
0E60
create view vv as select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
select * from vv;
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))
0043

Expected result

select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))
0E60
create view vv as select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
select * from vv;
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))
0E60

SHOW CREATE VIEW vv;

View	Create View	character_set_client	collation_connection
vv	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vv` AS select hex(weight_string(cast(_latin1'ch�' as char charset ucs2),2,4,193)) AS `hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))`	latin1	ucs2_unicode_ci


Generated at Thu Feb 08 10:07:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.