diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result index 56ea46a8052..48d4235a2fb 100644 --- a/mysql-test/suite/gcol/r/gcol_bugfixes.result +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -745,3 +745,41 @@ SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); INSERT IGNORE INTO t1 (id) VALUES (2); DROP TABLE t1; +# +# MDEV-28566 Assertion `!expr->is_fixed()' failed in bool +# Virtual_column_info::fix_session_expr(THD*) +# +CREATE TABLE t1 (c1 CHAR(1)); +FLUSH TABLES WITH READ LOCK; +UPDATE t1 SET c1=1; +ERROR HY000: Can't execute the query because you have a conflicting read lock +unlock tables; +SELECT * FROM t1; +c1 +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR AS (CONCAT (0,DAYNAME (0)))); +FLUSH TABLES WITH READ LOCK; +UPDATE t1 SET c1=1; +ERROR HY000: Can't execute the query because you have a conflicting read lock +unlock tables; +UPDATE t1 SET c1=1; +SELECT * FROM t1; +c1 +DROP TABLE t1; +CREATE TABLE t1 (a int primary key, c1 CHAR AS (CONCAT (0,DAYNAME (0)))); +insert into t1 (a) values (1); +FLUSH TABLES WITH READ LOCK; +UPDATE t1 SET c1=1; +ERROR HY000: Can't execute the query because you have a conflicting read lock +UPDATE t1 SET a=2; +ERROR HY000: Can't execute the query because you have a conflicting read lock +unlock tables; +UPDATE t1 SET a=2; +UPDATE t1 SET c1=1; +ERROR HY000: The value specified for generated column 'c1' in table 't1' has been ignored +SELECT * FROM t1; +a c1 +2 NULL +Warnings: +Warning 1292 Incorrect datetime value: '0' +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test index 4c1b00a878a..1edc9779d41 100644 --- a/mysql-test/suite/gcol/t/gcol_bugfixes.test +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -724,3 +724,38 @@ DROP TABLE t1; --remove_file $datadir/test/load_t1 +--echo # +--echo # MDEV-28566 Assertion `!expr->is_fixed()' failed in bool +--echo # Virtual_column_info::fix_session_expr(THD*) +--echo # + +CREATE TABLE t1 (c1 CHAR(1)); +FLUSH TABLES WITH READ LOCK; +--error ER_CANT_UPDATE_WITH_READLOCK +UPDATE t1 SET c1=1; +unlock tables; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 CHAR AS (CONCAT (0,DAYNAME (0)))); +FLUSH TABLES WITH READ LOCK; +--error ER_CANT_UPDATE_WITH_READLOCK +UPDATE t1 SET c1=1; +unlock tables; +UPDATE t1 SET c1=1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a int primary key, c1 CHAR AS (CONCAT (0,DAYNAME (0)))); +insert into t1 (a) values (1); +FLUSH TABLES WITH READ LOCK; +--error ER_CANT_UPDATE_WITH_READLOCK +UPDATE t1 SET c1=1; +--error ER_CANT_UPDATE_WITH_READLOCK +UPDATE t1 SET a=2; +unlock tables; +UPDATE t1 SET a=2; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +UPDATE t1 SET c1=1; +SELECT * FROM t1; +DROP TABLE t1; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 7642f41e46c..627dc6ff5f6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2191,6 +2191,7 @@ retry_share: if (thd->has_read_only_protection()) { MYSQL_UNBIND_TABLE(table->file); + table->vcol_cleanup_expr(thd); tc_release_table(table); DBUG_RETURN(TRUE); } @@ -2210,6 +2211,7 @@ retry_share: if (result) { MYSQL_UNBIND_TABLE(table->file); + table->vcol_cleanup_expr(thd); tc_release_table(table); DBUG_RETURN(TRUE); }