Bug #76962 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field
Submitted: 7 May 2015 5:52 Modified: 20 May 2015 15:25
Reporter: Shipra Jain Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[7 May 2015 5:52] Shipra Jain
Description:
Multiple assertion in  Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)) depending on the datatype used in column.

virtual longlong Field_long::val_int(): Assertion `!table ||
(!table->read_set || bitmap_is_set(table->read_set, field_index))'
failed.

but there are many others like :

virtual my_decimal* Field_new_decimal::val_decimal(my_decimal*):Assertion `!table || (!table->read_set ||bitmap_is_set(table->read_set,field_index))

virtual String* Field_blob::val_str(String*, String*): Assertion`!table|| (!table->read_set || bitmap_is_set(table->read_set, field_index))'
failed.

virtual double Field_float::val_real(): Assertion `!table ||(!table->read_set || bitmap_is_set(table->read_set, field_index))'failed.

etc ..

How to repeat:
MTR test for Field_tiny::val_int.

CREATE TABLE t1 (pk INTEGER, dummy VARCHAR(64), col_check TINYINT,
PRIMARY KEY(pk)); INSERT INTO t1 VALUES (13, '13', 13); COMMIT; CREATE
VIEW test . v1 AS SELECT * FROM test . t1 WHERE pk BETWEEN 13 AND 14;
PREPARE st1 FROM " UPDATE test . v1 AS A NATURAL JOIN test . v1 B SET
A.dummy = '' , B. col_check = NULL " ; EXECUTE st1;

==============

1. The UPDATE affects two "tables" which are here views + the views
are the same.
2. Depending on the data type of the column B. col_check the routine
where we get the asserts differs.
3. Using a prepared statement seems to be required.

In case you go with
PREPARE st1 FROM " UPDATE test . v1 AS A NATURAL JOIN test . t1 B SET
A.dummy = '' , B. col_check = NULL " ; EXECUTE st1; than you will
harvest the assert in Field_varstring::val_str.
There seems to be some exception from the general schema for DATETIME.
[20 May 2015 15:25] Paul DuBois
Noted in 5.7.8, 5.8.0 changelogs.

An assertion could be raised if a multiple-table UPDATE of a view,
where the same column was used in the SET and JOIN clauses, was used
as a prepared statement.
[18 Jun 2016 21:26] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0