|
When creating a table with two columns, the first one having a default with an expression, the running SHOW CREATE TABLE two times will corrupt the output on the second run:
> create table t(c1 char(19) not null default now(), c2 int);
|
> > show create table t;
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
| t | CREATE TABLE `t` (
|
`c1` char(19) NOT NULL DEFAULT now(),
|
`c2` int(11) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
> > show create table t;
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
| t | CREATE TABLE `t` (
|
`c1` char(19) NOT NULL DEFAULT NULL ,
|
`c2` int(11) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------+
|
Note that the default for column c1 got garbled in the second show create table. What ends up there depends on what the default expression is, in some cases it gets worse:
> create table t(c1 char(19) not null default uuid_short(), c2 int);
|
> show create table t;
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| t | CREATE TABLE `t` (
|
`c1` char(19) NOT NULL DEFAULT uuid_short(),
|
`c2` int(11) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
> show create table t;
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
| t | CREATE TABLE `t` (
|
`c1` char(19) NOT NULL DEFAULT NULL short(),
|
`c2` int(11) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------+
|
Note that the returned CREATE TABLE is totally invalid here (DEFAULT NULL short()). The issue only seems to happen when there are at least 2 columns in the table.
|