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

Illegal mix of collation when using GROUP_CONCAT in a VIEW

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5, 10.0, 10.1
    • 10.2.0
    • Views

    Description

      SET NAMES utf8;
      DROP TABLE IF EXISTS t1;
      DROP VIEW IF EXISTS v1;
      CREATE TABLE t1 (col1 VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
      INSERT INTO t1 VALUES ('a'),('b');
      CREATE VIEW v1 AS SELECT group_concat('f') AS col1;
      SELECT col1 FROM v1 UNION SELECT col1 FROM t1;

      returns

      ERROR 1271 (HY000) at line 7: Illegal mix of collations for operation 'UNION'

      This is very similar to:
      MySQL Bug#21505 Create view - illegal mix of collation for operation 'UNION'
      https://bugs.mysql.com/bug.php?id=21505
      which was fixed in 2006, but now for an aggregate function GROUP_CONCAT.

      The problem is that create_tmp_field_from_item() in sql_select.cc and Item_sum::create_tmp_field() are exactly the same 40 lines of the code.
      create_tmp_field_from_item() was fixed by Bug#21505, while Item_sum::create_tmp_field() was not.
      The code in create_tmp_field_from_item() should be moved as a method in Item, and Item_sum::create_tmp_field() should just reuse it.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.