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

Illegal mix of collations with DAYNAME(date_field)<>varchar_field

    XMLWordPrintable

    Details

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
      INSERT INTO t1 VALUES ('test',now());
      SELECT * FROM t1 WHERE DAYNAME(d)<>c;
      

      returns an error:

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

      It should work without errors.

      The same problem is repeatable with MONTHNAME:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
      INSERT INTO t1 VALUES ('test',now());
      SELECT * FROM t1 WHERE MONTHNAME(d)<>c;
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: