Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6588

VIEW do not work well with national character strings

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.3.12, 5.5.37, 10.0.13
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: