Description:
CREATE TABLE `t285` (
`a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
in
https://dev.mysql.com/doc/refman/5.6/en/columns-table.html
says :
in table information_schema.COLUMNS
[If COLUMN_KEY is PRI, the column is a PRIMARY KEY or is one of the columns in a multiple-column PRIMARY KEY.]
If COLUMN_KEY is UNI, the column is the first column of a UNIQUE index. (A UNIQUE index permits multiple NULL values, but you can tell whether the column permits NULL by checking the Null column.)]
actually it is PRI ,not UNI
How to repeat:
mysql> show create table t285;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t285 | CREATE TABLE `t285` (
`a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from information_schema.COLUMNS where TABLE_NAME='t285';
+---------------+--------------+------------+-------------+------------------+----------------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+--------------+------------+--------------------------------+---------------------------------+----------------+-----------------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES | COLUMN_COMMENT | GENERATION_EXPRESSION |
+---------------+--------------+------------+-------------+------------------+----------------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+--------------+------------+--------------------------------+---------------------------------+----------------+-----------------------+
| def | test | t285 | a | 1 | CURRENT_TIMESTAMP(6) | NO | timestamp | NULL | NULL | NULL | NULL | 6 | NULL | NULL | timestamp(6) | PRI | on update CURRENT_TIMESTAMP(6) | select,insert,update,references | | |
+---------------+--------------+------------+-------------+------------------+----------------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+--------------+------------+--------------------------------+---------------------------------+----------------+-----------------------+
1 row in set (0.14 sec)