Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL)
-
None
Description
This script correctly returns latin1:
SET NAMES utf8; |
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; |
+-------------------------------+
|
| CHARSET(CONCAT(5,_latin1'a')) |
|
+-------------------------------+
|
| latin1 |
|
+-------------------------------+
|
If I use a similar query, but pass the number as a parameter, it erroneously returns binary:
EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; |
+-------------------------------+
|
| CHARSET(CONCAT(?,_latin1'a')) |
|
+-------------------------------+
|
| binary |
|
+-------------------------------+
|
The expected result is to return _latin1.
The problem happens because Item_param does not set its DTCollation properly. These queries erroneously return 4 (DERIVATION_COERCIBLE), instead of 5 (DERIVATION_NUMERIC).
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; |
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; |
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; |
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; |
EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; |