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

Bad SEPARATOR value in GROUP_CONCAT on character set conversion

    XMLWordPrintable

Details

    Description

      The following script produces a wrong output - a non-ASCII SEPARATOR in GROUP_CONCAT gets replaced to the question mark.

      SET NAMES utf8, @@collation_connection=latin1_swedish_ci;
      CREATE OR REPLACE TABLE t1 (c VARCHAR(10)) CHARACTER SET latin1;
      INSERT INTO t1 VALUES ('a'),('A');
      CREATE OR REPLACE VIEW v1 AS
        SELECT LEFT(GROUP_CONCAT(c SEPARATOR 'ß'), 20) AS example FROM t1 GROUP BY c;
      SELECT * FROM v1;
      

      +---------+
      | example |
      +---------+
      | a?A     |
      +---------+
      

      The output looks wrong. The expected result is 'aßA'.

      SHOW CREATE VIEW output is also wrong.

      SHOW CREATE VIEW v1;
      

      +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | View | Create View                                                                                                                                                                          | character_set_client | collation_connection |
      +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | v1   | CREATE ALGORITHM=UNDEFINED DEFINER=`bar`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left(group_concat(`t1`.`c` separator '?'),20) AS `example` from `t1` group by `t1`.`c` | utf8mb3              | latin1_swedish_ci    |
      +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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