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

Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument

    XMLWordPrintable

Details

    • 10.2.10

    Description

      Test case

      CREATE TABLE t1 (c VARCHAR(8));
      INSERT INTO t1 VALUES ('abc'),('def');
       
      SELECT
        JSON_OBJECT('foo', JSON_UNQUOTE(JSON_OBJECT('bar', c)),'qux', c) AS fld
      FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2, 10.3

      MariaDB [test]> SELECT
          ->   JSON_OBJECT('foo', JSON_UNQUOTE(JSON_OBJECT('bar', c)),'qux', c) AS fld
          -> FROM t1;
      ERROR 1271 (HY000): Illegal mix of collations for operation 'json_object'
      

      MySQL 5.7

      MySQL [test]> SELECT
          ->   JSON_OBJECT('foo', JSON_UNQUOTE(JSON_OBJECT('bar', c)),'qux', c) AS fld
          -> FROM t1;
      +---------------------------------------------+
      | fld                                         |
      +---------------------------------------------+
      | {"foo": "{\"bar\": \"abc\"}", "qux": "abc"} |
      | {"foo": "{\"bar\": \"def\"}", "qux": "def"} |
      +---------------------------------------------+
      2 rows in set (0.00 sec)
      

      Attachments

        Activity

          People

            holyfoot Alexey Botchkov
            elenst Elena Stepanova
            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.