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

Malformed strings are accepted as column names when SET NAMES binary

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.5.39, 10.0.13
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: