CREATE TABLE t0(c0 INT UNIQUE, c1 INT AS (c0) VIRTUAL NOT NULL);
INSERT INTO t0(c0) VALUES (1);
INSERT INTO t0(c0) VALUES (1) ON DUPLICATE KEY UPDATE c0=0;
Unexpectedly, the INSERT results in an error Miss column:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.25-TiDB- TiDB Server (Apache License 2.0), MySQL 5.7 compatible
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE TABLE t0(c0 INT UNIQUE, c1 INT AS (c0) VIRTUAL NOT NULL);
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO t0(c0) VALUES (1);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO t0(c0) VALUES (1) ON DUPLICATE KEY UPDATE c0=0;
ERROR 1105 (HY000): Miss column
I would expect that the INSERT is executed without error, which is also the case with MySQL 8.0.19:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE TABLE t0(c0 INT UNIQUE, c1 INT AS (c0) VIRTUAL NOT NULL);
Query OK, 0 rows affected (0.04 sec)
mysql> INSERT INTO t0(c0) VALUES (1);
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO t0(c0) VALUES (1) ON DUPLICATE KEY UPDATE c0=0;
Query OK, 2 rows affected (0.01 sec)
I found this based on the latest master commit 187f225002b67daa47992816f6ef5ddb76b0f68a, and also checked that this reproduces on the 4.0 RC.
Consider the following statements:
Unexpectedly, the
INSERT
results in an errorMiss column
:I would expect that the
INSERT
is executed without error, which is also the case with MySQL 8.0.19:I found this based on the latest master commit 187f225002b67daa47992816f6ef5ddb76b0f68a, and also checked that this reproduces on the 4.0 RC.