mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -2483,3 +2483,19 @@ Warnings:
|
||||
Note 1291 Column 'a' has duplicated value '' in ENUM
|
||||
drop table t1;
|
||||
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;
|
||||
create table t1(a enum('',''));
|
||||
drop table t1;
|
||||
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)
|
||||
DBUG_RETURN(1);
|
||||
table->mark_columns_needed_for_insert();
|
||||
table->file->extra(HA_EXTRA_WRITE_CACHE);
|
||||
// Mark table as used
|
||||
table->query_id= thd->query_id;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user