Commit 6b614c62 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-7765: Crash (Assertion `!table || (!table->write_set ||...

MDEV-7765: Crash (Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' fails) on using function over not created table

Problem was that created table was not marked as used (not set query_id) and so opening tables for stored function pick it up (as opened place holder for it) and used changing TABLE internals.
parent 775cccca
...@@ -2483,3 +2483,19 @@ Warnings: ...@@ -2483,3 +2483,19 @@ Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1; drop table t1;
set @@session.collation_server=default; set @@session.collation_server=default;
#
# MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
# bitmap_is_set(table->write_set, field_index) ||
# bitmap_is_set(table->vcol_set, field_index))' fails)
# on using function over not created table
#
CREATE function f1() returns int
BEGIN
declare n int;
set n:= (select count(*) from t1);
return n;
end|
create table t1 as select f1();
ERROR 42S02: Table 'test.t1' doesn't exist
drop function f1;
End of 5.5 tests
...@@ -2061,3 +2061,24 @@ set @@session.collation_server=filename; ...@@ -2061,3 +2061,24 @@ set @@session.collation_server=filename;
create table t1(a enum('','')); create table t1(a enum('',''));
drop table t1; drop table t1;
set @@session.collation_server=default; set @@session.collation_server=default;
--echo #
--echo # MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
--echo # bitmap_is_set(table->write_set, field_index) ||
--echo # bitmap_is_set(table->vcol_set, field_index))' fails)
--echo # on using function over not created table
--echo #
DELIMITER |;
CREATE function f1() returns int
BEGIN
declare n int;
set n:= (select count(*) from t1);
return n;
end|
DELIMITER ;|
-- error ER_NO_SUCH_TABLE
create table t1 as select f1();
drop function f1;
--echo End of 5.5 tests
...@@ -4151,6 +4151,8 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) ...@@ -4151,6 +4151,8 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
DBUG_RETURN(1); DBUG_RETURN(1);
table->mark_columns_needed_for_insert(); table->mark_columns_needed_for_insert();
table->file->extra(HA_EXTRA_WRITE_CACHE); table->file->extra(HA_EXTRA_WRITE_CACHE);
// Mark table as used
table->query_id= thd->query_id;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
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