Commit 50b9e30b authored by Igor Babaev's avatar Igor Babaev

Fixed bug mdev-5611.

The method Item_field::update_table_bitmaps() should not try
to mark the bit for a self-referencing virtual column.
parent 5b441013
......@@ -316,4 +316,9 @@ ERROR HY000: The value specified for computed column 'd' in table 't1' ignored
INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a');
ERROR HY000: The value specified for computed column 'd' in table 't1' ignored
drop table t1;
#
# MDEV-5611: self-referencing virtual column
#
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
# end of 5.3 tests
......@@ -275,4 +275,11 @@ UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a
INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a');
drop table t1;
--echo #
--echo # MDEV-5611: self-referencing virtual column
--echo #
--error ER_VCOL_BASED_ON_VCOL
create table t1 (a int, b int as (b is null) virtual);
--echo # end of 5.3 tests
......@@ -1877,7 +1877,11 @@ class Item_field :public Item_ident
tab->merge_keys.merge(field->part_of_key);
if (tab->read_set)
bitmap_fast_test_and_set(tab->read_set, field->field_index);
if (field->vcol_info)
/*
Do not mark a self-referecing virtual column.
Such virtual columns are reported as invalid.
*/
if (field->vcol_info && tab->vcol_set)
tab->mark_virtual_col(field);
}
}
......
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