Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
None
-
10.1.31
Description
Even though user invisible columns are supposed to have default values, this works:
MariaDB [test]> create or replace table t1 (pk int auto_increment primary key invisible, i int); |
# Query OK, 0 rows affected (0.16 sec) |
|
MariaDB [test]> alter table t1 modify pk int invisible; |
# Query OK, 0 rows affected (0.80 sec) |
# Records: 0 Duplicates: 0 Warnings: 0
|
The resulting table structure is this:
MariaDB [test]> show create table t1; |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------+ |
| Table | Create Table | |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------+ |
| t1 | CREATE TABLE `t1` ( |
`pk` int(11) NOT NULL INVISIBLE, |
`i` int(11) DEFAULT NULL, |
PRIMARY KEY (`pk`) |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------+ |
1 row in set (0.01 sec) |
If you try to execute it, it produces an error:
MariaDB [test]> drop table t1; |
Query OK, 0 rows affected (0.07 sec) |
|
MariaDB [test]> CREATE TABLE `t1` ( |
-> `pk` int(11) NOT NULL INVISIBLE, |
-> `i` int(11) DEFAULT NULL, |
-> PRIMARY KEY (`pk`) |
-> ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
ERROR 4106 (HY000): Invisible column `pk` must have a default value |
My guess is that ALTER in the initial pair of commands should be rejected.