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

COLUMN_CREATE unicode name breakage

Details

    • 10.2.11

    Description

      Possibly related to MDEV-461.

      When calling column_create with names set to utf8, one can successfully
      encode an emoji that takes 4 bytes in utf-8:

      adamj@localhost [1]> set names utf8;
      adamj@localhost [2]> select column_json(column_create('��', 1));
      +---------------------------------------+
      | column_json(column_create('��', 1))     |
      +---------------------------------------+
      | {"��":1}                                |
      +---------------------------------------+

      However if the connection is set to utf8mb4 this actually fails,
      counter-intuitively:

      adamj@localhost [3]> set names utf8mb4;
      adamj@localhost [4]> select column_json(column_create('��', 1));
      +------------------------------------+
      | column_json(column_create('?', 1)) |
      +------------------------------------+
      | {"?":1}                            |
      +------------------------------------+
       
      adamj@localhost [5]> select column_list(column_create('��', 1));
      +------------------------------------+
      | column_list(column_create('?', 1)) |
      +------------------------------------+
      | `?`                                |
      +------------------------------------+

      Other unicode characters work fine though:

      adamj@localhost [6]> select column_list(column_create('❤', 1));
      +--------------------------------------+
      | column_list(column_create('❤', 1))   |
      +--------------------------------------+
      | `❤`                                  |
      +--------------------------------------+

      Attachments

        Activity

          revision-id: e22c33e3f014ffc4d7c08d6830f710c19f1aff90 (mariadb-10.0.33-17-ge22c33e3f01)
          parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7
          author: Oleksandr Byelkin
          committer: Oleksandr Byelkin
          timestamp: 2017-11-13 16:30:02 +0100
          message:

          MDEV-8949: COLUMN_CREATE unicode name breakage

          Use utf-mb4 if it is possible.

          sanja Oleksandr Byelkin added a comment - revision-id: e22c33e3f014ffc4d7c08d6830f710c19f1aff90 (mariadb-10.0.33-17-ge22c33e3f01) parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2017-11-13 16:30:02 +0100 message: MDEV-8949 : COLUMN_CREATE unicode name breakage Use utf-mb4 if it is possible. —

          github tree: bb-10.0-MDEV-8949

          sanja Oleksandr Byelkin added a comment - github tree: bb-10.0- MDEV-8949

          There is one more character set related problem with COLUMN_LIST() and COLUMN_GET():

          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 AS SELECT
            COLUMN_LIST(COLUMN_CREATE('a',1)),
            COLUMN_JSON(COLUMN_CREATE('b',1));
          SHOW CREATE TABLE t1;
          

          +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Table | Create Table                                                                                                                                                                        |
          +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | t1    | CREATE TABLE `t1` (
            `COLUMN_LIST(COLUMN_CREATE('a',1))` longblob DEFAULT NULL,
            `COLUMN_JSON(COLUMN_CREATE('b',1))` longblob DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
          +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          

          Notice, these functions create longblob columns.
          The expected result would be longtext CHARACTER SET utf8mb4.

          bar Alexander Barkov added a comment - There is one more character set related problem with COLUMN_LIST() and COLUMN_GET() : DROP TABLE IF EXISTS t1; CREATE TABLE t1 AS SELECT COLUMN_LIST(COLUMN_CREATE( 'a' ,1)), COLUMN_JSON(COLUMN_CREATE( 'b' ,1)); SHOW CREATE TABLE t1; +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `COLUMN_LIST(COLUMN_CREATE('a',1))` longblob DEFAULT NULL, `COLUMN_JSON(COLUMN_CREATE('b',1))` longblob DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Notice, these functions create longblob columns. The expected result would be longtext CHARACTER SET utf8mb4 .

          revision-id: 2913f615f050f356f7be178e5d91650b86b33e4e (mariadb-10.0.33-17-g2913f615f05)
          parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7
          author: Oleksandr Byelkin
          committer: Oleksandr Byelkin
          timestamp: 2017-11-14 10:49:46 +0100
          message:

          MDEV-8949: COLUMN_CREATE unicode name breakage

          Use utf-mb4 if it is possible.

          sanja Oleksandr Byelkin added a comment - revision-id: 2913f615f050f356f7be178e5d91650b86b33e4e (mariadb-10.0.33-17-g2913f615f05) parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2017-11-14 10:49:46 +0100 message: MDEV-8949 : COLUMN_CREATE unicode name breakage Use utf-mb4 if it is possible. —

          This patch is OK to push:

          revision-id: 2913f615f050f356f7be178e5d91650b86b33e4e (mariadb-10.0.33-17-g2913f615f05)
          parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7
          author: Oleksandr Byelkin
          committer: Oleksandr Byelkin
          timestamp: 2017-11-14 10:49:46 +0100
          message:

          bar Alexander Barkov added a comment - This patch is OK to push: revision-id: 2913f615f050f356f7be178e5d91650b86b33e4e (mariadb-10.0.33-17-g2913f615f05) parent(s): c0e10f375ad619d825ef7c21232cf5946bdf5be7 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2017-11-14 10:49:46 +0100 message:

          People

            sanja Oleksandr Byelkin
            adamchainz Adam Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.