maria-docs team mailing list archive
-
maria-docs team
-
Mailing list archive
-
Message #00281
edit on virtual columns
Hi. I edited the Virtual Columns page
https://mariadb.com/kb/en/virtual-columns/
It said that ALTER TABLE was fully supported. I modified this way:
##ALTER TABLE##'s ##MODIFY## and ##CHANGE## clauses are supported for ##PERSISTENT## columns, but not for ##VIRTUAL## columns.
This is based on the following test:
MariaDB [(none)]> SELECT VERSION();
+--------------------+
| VERSION() |
+--------------------+
| 10.0.4-MariaDB-log |
+--------------------+
1 row in set (0.07 sec)
MariaDB [(none)]> DROP TABLE IF EXISTS `test`.`t`;
Query OK, 0 rows affected (0.08 sec)
MariaDB [(none)]> CREATE TABLE `test`.`t`(`c` INT, `v` INT) ENGINE = InnoDB;
Query OK, 0 rows affected (0.17 sec)
MariaDB [(none)]> ALTER TABLE `test`.`t` MODIFY COLUMN `v` INTEGER GENERATED ALW
AYS AS (`c`+1) VIRTUAL;
ERROR 1907 (HY000): This is not yet supported for computed columns
MariaDB [(none)]> ALTER TABLE `test`.`t` MODIFY COLUMN `v` INTEGER GENERATED ALW
AYS AS (`c`+1) PERSISTENT;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [(none)]> ALTER TABLE `test`.`t` MODIFY COLUMN `v` INTEGER;
Query OK, 0 rows affected (2.27 sec)
Records: 0 Duplicates: 0 Warnings: 0
Federico
References