[MDEV-6694] Illegal mix of collation with a PS parameter Created: 2014-09-04  Updated: 2014-09-04  Resolved: 2014-09-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.39, 10.0.13
Fix Version/s: 10.0.14

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

This is similar to MDEV-6688 (Illegal mix of collation with bit string B'01100001'),
but now for PS parameters:

SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT, b VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES (1,'a');
SELECT CONCAT(b,IF(a,'b','b')) FROM t1;
 
PREPARE stmt FROM "SELECT CONCAT(b,IF(a,?,?)) FROM t1";
SET @b='b'; 
EXECUTE stmt USING @b,@b;

correctly returns 'ab' for the first SELECT with string literals,
but returns an error for the second SELECT with PS parameters:

ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'

It should return 'ab' for the second SELECT, because the parameter value
is pure ASCII and therefore should be safely concatenated with a Latin1
field.


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