diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 1a16fd1a3944e..b6ce12f690ecc 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -591,3 +591,13 @@ DROP TABLE t; # # End of 10.5 tests # +# +# Start of 10.11 tests +# +SET character_set_connection=ucs2; +CREATE TABLE t1 (d1 date not null, d2 date, gd text as (concat(d1,if(d1 <> d2, date_format(d2, 'to %y-%m-%d '), ''))) ); +SELECT (SELECT 1 FROM foo) FROM t1; +ERROR 42S02: Table 'test.foo' doesn't exist +INSERT INTO t1 (d1) VALUES ('2009-07-02'); +DROP TABLE t1; +# End of 10.11 tests diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 2709ff5b46535..4a64b74853e55 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -207,7 +207,13 @@ SELECT COUNT(*) FROM t1; INSERT INTO t1 (a,tsv) VALUES (5,DEFAULT); INSERT DELAYED INTO t1 (a,tsv) VALUES (6,DEFAULT); FLUSH TABLES WITH READ LOCK; +# Under view protocol the following SELECT is issued as CREATE VIEW on a +# separate connection. That statement blocks on the global read lock held +# here and would not return until the UNLOCK TABLES below, which the same +# client cannot reach while it waits. Run it directly to avoid the deadlock. +--disable_view_protocol SELECT COUNT(*) FROM t1; +--enable_view_protocol set GLOBAL debug_dbug= @old_debug; unlock tables; DROP TABLE t1; @@ -560,3 +566,18 @@ DROP TABLE t; --echo # --echo # End of 10.5 tests --echo # + +--echo # +--echo # Start of 10.11 tests +--echo # + +# Charset difference required which inserts a charset converter, forcing the column value read later. +SET character_set_connection=ucs2; +CREATE TABLE t1 (d1 date not null, d2 date, gd text as (concat(d1,if(d1 <> d2, date_format(d2, 'to %y-%m-%d '), ''))) ); +# Necessary to get table t1 into the cache. Without this SELECT, the crash is not evident. +--ERROR ER_NO_SUCH_TABLE +SELECT (SELECT 1 FROM foo) FROM t1; +INSERT INTO t1 (d1) VALUES ('2009-07-02'); +DROP TABLE t1; + +--echo # End of 10.11 tests diff --git a/sql/table.cc b/sql/table.cc index 2b283fd93e1b8..036b3e3e1e037 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3723,6 +3723,7 @@ bool Vcol_expr_context::init() thd->set_n_backup_active_arena(table->expr_arena, &backup_arena); thd->stmt_arena= thd; + table->map= 1; inited= true; return false; }