Commit 06f7ed4d authored by Monty's avatar Monty

MDEV-28566 Assertion `!expr->is_fixed()' failed in bool virtual_column_info::fix_session_expr(THD*)

The problem was that table->vcol_cleanup_expr() was not called in case
of error in open_table().
parent 08e6431c
......@@ -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;
......@@ -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;
......@@ -2191,6 +2191,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
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 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
if (result)
{
MYSQL_UNBIND_TABLE(table->file);
table->vcol_cleanup_expr(thd);
tc_release_table(table);
DBUG_RETURN(TRUE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment