Commit ca28d901 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-7655 SHOW CREATE TABLE returns invalid DDL when using virtual columns...

MDEV-7655 SHOW CREATE TABLE returns invalid DDL when using virtual columns along with a table collation
parent f560c1ba
......@@ -322,3 +322,11 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
# end of 5.3 tests
create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=latin1_general_ci;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v1` varchar(255) AS (c1) PERSISTENT,
`c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
drop table t1;
......@@ -283,3 +283,10 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
--echo # end of 5.3 tests
#
# MDEV-7655 SHOW CREATE TABLE returns invalid DDL when using virtual columns along with a table collation
#
create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=latin1_general_ci;
show create table t1;
drop table t1;
......@@ -1611,7 +1611,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
For string types dump collation name only if
collation is not primary for the given charset
*/
if (!(field->charset()->state & MY_CS_PRIMARY))
if (!(field->charset()->state & MY_CS_PRIMARY) && !field->vcol_info)
{
packet->append(STRING_WITH_LEN(" COLLATE "));
packet->append(field->charset()->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment