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

LP:610890 - SHOW CREATE TABLE produces invalid SQL when used with virtual columns with non-default character sets

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      SHOW CREATE TABLE produces a CREATE TABLE statement where any CHARACTER SET clauses are incorrectly placed, making the SQL invalid. SHOW CREATE TABLE is used by mysqldump.

      mysql> create table t1 (f1 char(32), v2 char(32) character set ucs2 AS (f1) VIRTUAL);
      mysql> show create table t1\G

                                                          • 1. row ***************************
                                                            Table: t1
                                                            Create Table: CREATE TABLE `t1` (
                                                            `f1` char(32) DEFAULT NULL,
                                                            `v2` char(32) AS (f1) VIRTUAL CHARACTER SET ucs2
                                                            ) ENGINE=InnoDB DEFAULT CHARSET=latin1
                                                            1 row in set (0.00 sec)

      This SQL is not valid – CHARACTER SET was placed after VIRTUAL, even though it must be between char(32) and AS.

      All of the following must come before the AS () virtual column definition:

      • field type and dimensions;
      • unsigned
      • zerofill
      • character set
      • collation

      Attachments

        Activity

          People

            igor Igor Babaev (Inactive)
            philipstoev Philip Stoev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.