Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
5.3.12, 5.5.37, 10.0.13
-
None
-
None
Description
This SQL script:
SET NAMES latin1; |
DROP VIEW IF EXISTS v1; |
CREATE VIEW v1 AS |
SELECT CHARSET('a'),CHARSET(_utf8'a'),CHARSET(N'a'); |
SHOW CREATE VIEW v1; |
SELECT * FROM v1; |
produces the following output for SHOW CREATE VIEW:
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| View | Create View | character_set_client | collation_connection |
|
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select charset('a') AS `CHARSET('a')`,charset(_utf8'a') AS `CHARSET(_utf8'a')`,charset('a') AS `CHARSET(N'a')` | latin1 | latin1_swedish_ci |
|
+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
and this output for SELECT:
+--------------+-------------------+---------------+
|
| CHARSET('a') | CHARSET(_utf8'a') | CHARSET(N'a') |
|
+--------------+-------------------+---------------+
|
| latin1 | utf8 | latin1 |
|
+--------------+-------------------+---------------+
|
1 row in set (0.00 sec)
|
Both results are wrong:
- The national character string loses the "N" prefix in SHOW CREATE.
It should preserve the "N" prefix. - The national character string is reported as being latin1.
It should always be reported as utf8, not matter what
@@character_set_connection or @@character_set_client are set to.