Bug #85179 Assert in sql/field.cc:... virtual String* Field_varstring::val_str
Submitted: 24 Feb 2017 19:28 Modified: 16 Mar 2017 21:00
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.1-dmr OS:Any
Assigned to: CPU Architecture:Any

[24 Feb 2017 19:28] Matthias Leich
Description:
mysql-trunk-meta-sync 4b0a9976c661c9be579d57c92fb7eab478dc5fec
Date:   Fri Feb 24 13:49:30 2017 +0100

+CREATE TABLE test . t0 (col1 INT, col2 INT, col3 INT);
+INSERT INTO test . t0 VALUES (1,1,1);
+ALTER TABLE test . t0 ADD COLUMN col4 VARCHAR(500);
+UPDATE test . t0 SET col4 = REPEAT('z', 100);
+CREATE TABLE t1_2 ENGINE = InnoDB PARTITION BY RANGE(col1) ( PARTITION p0 VALUES LESS THAN (128) , PARTITION p3 VALUES LESS THAN MAXVALUE ) AS
+SELECT col1, col2, col3, col4 FROM test . t0;
+ALTER TABLE t1_2 ADD COLUMN col5 VARCHAR(500) GENERATED ALWAYS AS (SUBSTR(col4,1,500)) STORED;
+ALTER TABLE t1_2 ADD COLUMN extra VARCHAR(500);
+UPDATE t1_2 SET extra = col5;
+ERROR HY000: Lost connection to MySQL server during query
+DROP TABLE t1_2;
+ERROR HY000: MySQL server has gone away

Version: '8.0.1-dmr-debug-log'  socket: '/work/mysql-trunk-meta-sync/mysql-test/var/tmp/mysqld.1.sock'  port: 13000  Source distribution
[ERROR] Invalid (old?) table or database name 'mysqld.1'
[ERROR] Invalid (old?) table or database name 'mysqld.1'
[ERROR] Invalid (old?) table or database name 'mysqld.1'
mysqld: sql/field.cc:7663: virtual String* Field_varstring::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.

Query (7f1ebc180220): UPDATE t1_2 SET extra = col5
Status: NOT_KILLED

How to repeat:
--disable_abort_on_error

CREATE TABLE test . t0 (col1 INT, col2 INT, col3 INT);
INSERT INTO test . t0 VALUES (1,1,1);
ALTER TABLE test . t0 ADD COLUMN col4 VARCHAR(500);
UPDATE test . t0 SET col4 = REPEAT('z', 100);
CREATE TABLE t1_2 ENGINE = InnoDB PARTITION BY RANGE(col1) ( PARTITION p0 VALUES LESS THAN (128) , PARTITION p3 VALUES LESS THAN MAXVALUE ) AS
SELECT col1, col2, col3, col4 FROM test . t0;
ALTER TABLE t1_2 ADD COLUMN col5 VARCHAR(500) GENERATED ALWAYS AS (SUBSTR(col4,1,500)) STORED;
ALTER TABLE t1_2 ADD COLUMN extra VARCHAR(500);
UPDATE t1_2 SET extra = col5;
DROP TABLE t1_2;
[16 Mar 2017 21:00] Paul Dubois
Posted by developer:
 
Noted in 8.0.2 changelog.

For debug builds, the partitioning handler could inappropriately
evaluate generated column expressions in UPDATE statements, resulting
in a raised assertion.