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

Illegal mix of collations with a view comparing a field to a binary constant

    XMLWordPrintable

Details

    Description

      This script:

      SET NAMES latin1;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a TEXT CHARACTER SET gbk);
      INSERT INTO t1 VALUES (0xEE5D);
      SELECT a<> 0xEE5D AS a FROM t1;
      

      correctly returns one row:

      +------+
      | a    |
      +------+
      |    0 |
      +------+
      

      Now if I put the same SELECT into a VIEW and query it:

      DROP VIEW IF EXISTS v1;
      CREATE VIEW v1 AS SELECT a<> 0xEE5D AS a FROM t1;
      SELECT * FROM v1;
      

      it returns an error:

      ERROR 1267 (HY000): Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '<>'
      

      Attachments

        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.