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

VIEW do not work well with national character strings

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.3.12, 5.5.37, 10.0.13
    • 10.6
    • 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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.