[MDEV-3844] INSERT with no fields names on a table with Virtual Columns raises an error Created: 2012-11-09 Updated: 2012-11-17 Resolved: 2012-11-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Federico Razzoli | Assignee: | Elena Stepanova |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
One can INSERT a row into a table without specifying the fields names. But if the table contains Virtual Columns, you don't include those values in the statement. But then, MariaDB says that column count doesn't match. MariaDB [test]> DROP VIEW IF EXISTS `t1`; MariaDB [test]> DROP TABLE IF EXISTS `t1`; MariaDB [test]> CREATE TABLE `t1` ( MariaDB [test]> INSERT INTO `t1` VALUES (1); |
| Comments |
| Comment by Elena Stepanova [ 2012-11-09 ] |
|
Hi Federico, This behavior is consistent with other cases when a column has a default value or is calculated automatically, e.g. is an auto-increment column. In case of virtual columns, if you want to insert without specifying field names, you can use the 'default' keyword: INSERT INTO `t1` VALUES (1, default); I suppose NULL should also work. |