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

Misleading ER_INVALID_CHARACTER_STRING message for DDL statements

    XMLWordPrintable

    Details

      Description

      The system_charset_info that MariaDB uses for schema object names (such as tables, indexes and columns) only supports the Basic Multilingual Plane (Unicode code points below U+10000), that is, at most 3 bytes per character.

      In MariaDB 10.0 and 10.1, the test innodb.innodb-alter returns the following error message to 4-byte UTF-8 data:

      ERROR HY000: Invalid utf8 character string: '\xF0\x9F\x98\xB2'

      This is somewhat misleading, because the quoted byte sequence is valid UTF-8. We could still claim that utf8 is an alias to utf8mb3 and say that this is not an error.

      However, starting with MariaDB 10.2, the error message is unambiguously misleading:

      ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2'

      The 4-byte sequence is pretty much valid in utf8mb4. The error message should convey the correct meaning that while this sequence is valid utf8mb4, only utf8mb3 is valid for a schema object name.

      At the very least we should change the utf8mb4 to utf8mb3. It would be better to say something like ‘invalid schema object name’.

      Unfortunately, I cannot quote the exact statement that produces the above error, because Jira does not allow 4-byte UTF-8 data. Here is a stand-alone test case that works around the Jira limitation:

      SET NAMES utf8mb4;
      CREATE TEMPORARY TABLE t1 (c3 INT);
      --error ER_INVALID_CHARACTER_STRING
      EXECUTE IMMEDIATE CONCAT('ALTER TABLE t1 CHANGE c3 ',_utf8mb4 0xF09F98B2,' INT');
      

      This will return the same misleading error message that is returned for the statement in innodb.innodb-alter:

      10.2 c676f58c270d75b6c1889b24b9833afc65b0d98b

      ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2'
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            marko Marko Mäkelä
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration