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

Malformed strings are accepted as column names when SET NAMES binary

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.39, 10.0.13
    • 5.5
    • None
    • None

    Description

      Run an new iso-8859-1 terminal window.
      For example, in gnome-terminal, do:
      Terminal -> Set character encoding -> Western (ISO-8859-1)

      Execute this command:

      LANG=de_DE.iso88591 ; mysql test <<END
      SET NAMES binary;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 AS SELECT 'aaaßßß';
      END

      Now run a new UTF8 terminal window.
      For example, in gnome-terminal, do:
      Terminal -> Set character encoding -> Unicode (UTF-8)

      Execute this command:

      mysql --table test << END
      SET NAMES utf8;
      SHOW CREATE TABLE t1;
      END

      The output is incorrect:

      +-------+---------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                            |
      +-------+---------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `aaa��� ` varbinary(6) NOT NULL DEFAULT ''
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1    |
      +-------+---------------------------------------------------------------------------------------------------------+

      Notice, the column name after 'aaa' has replacement characters,
      which are printed for invalid sequences.

      The desired behavior would be to report an error at CREATE TABLE,
      as the supplied name is not a valid UTF-8 string.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.