|
ALTER TABLE .. ALTER .. SET DEFAULT allows to set a default value for a virtual column, which doesn't make sense. It is not further reflected in SHOW CREATE TABLE because there is no such syntax, but it is shown in INFORMATION_SCHEMA, which can be misleading (and is inconsistent).
create table t (a int, b int as (a));
|
alter table t alter b set default 1;
|
show create table t;
|
select column_name, column_default from information_schema.columns where table_name = 't';
|
drop table t;
|
|
11.2 9ad7c899
|
alter table t alter b set default 1;
|
show create table t;
|
Table Create Table
|
t CREATE TABLE `t` (
|
`a` int(11) DEFAULT NULL,
|
`b` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
select column_name, column_default from information_schema.columns where table_name = 't';
|
column_name column_default
|
a NULL
|
b 1
|
|