Details
Description
In Linux console, I run
SET NAMES utf8; |
SELECT CHAR(0xDF USING latin1); |
+-------------------------+
|
| CHAR(0xDF USING latin1) |
|
+-------------------------+
|
| ß |
|
+-------------------------+
|
Notice, it correctly returned LATIN SMALL LETTER SHARP S.
Now I put the same expression into a view and query the view:
CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c; |
SELECT * FROM v1; |
+---+
|
| c |
|
+---+
|
| � |
|
+---+
|
Notice, it returned some garbage (Linux console changed garbage to U+FFFD REPLACEMENT CHARACTER).
Looks wrong. The expected result is to return the same SHARP S character.
The problem is that Item_func_char::print() does not display the USING clause:
SHOW CREATE VIEW v1; |
+------+------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| View | Create View | character_set_client | collation_connection |
|
+------+------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select char(0xdf) AS `c` | utf8 | utf8_general_ci |
|
+------+------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
Notice, it prints:
char(0xdf)
|
It should print:
char(0xdf using latin1)
|
Attachments
Issue Links
- relates to
-
MDEV-12680 Crash when CREATE TABLE t1 AS SELECT char(100 using filename)
- Closed