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

Bug #610890 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Igor Babaev

Bug 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

Changed in maria:
importance: Undecided → High
assignee: nobody → Igor Babaev (igorb-seattle)
milestone: none → 5.2
Changed in maria:
status: New → Confirmed
Changed in maria:
status: Confirmed → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.