Commit 27380e4f authored by Igor Babaev's avatar Igor Babaev

Fixed LP bug #794005.

The function st_table::mark_virtual_columns_for_write() did not take into
account the fact that for any table the value of st_table::vfield is 0
when there are no virtual columns in the table definition.
parent bad3e417
......@@ -3926,3 +3926,14 @@ drop table t1,t2;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
#
# Bug #794005: crash in st_table::mark_virtual_columns_for_write
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE VIEW v2 AS SELECT * FROM t2;
CREATE VIEW v1 AS SELECT * FROM v2;
CREATE OR REPLACE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT * FROM t1;
UPDATE v1 SET a = 10;
DROP VIEW v1,v2;
DROP TABLE t1,t2;
......@@ -3976,3 +3976,19 @@ drop table t1,t2;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------
--echo #
--echo # Bug #794005: crash in st_table::mark_virtual_columns_for_write
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE VIEW v2 AS SELECT * FROM t2;
CREATE VIEW v1 AS SELECT * FROM v2;
CREATE OR REPLACE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT * FROM t1;
UPDATE v1 SET a = 10;
DROP VIEW v1,v2;
DROP TABLE t1,t2;
......@@ -5161,6 +5161,9 @@ void st_table::mark_virtual_columns_for_write(bool insert_fl)
Field **vfield_ptr, *tmp_vfield;
bool bitmap_updated= FALSE;
if (!vfield)
return;
for (vfield_ptr= vfield; *vfield_ptr; vfield_ptr++)
{
tmp_vfield= *vfield_ptr;
......
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