Bug #75424 EXPLAIN for insert into a view shows wrong table for insertion
Submitted: 6 Jan 2015 14:23 Modified: 7 Apr 2015 13:44
Reporter: Roy Lyseng Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[6 Jan 2015 14:23] Roy Lyseng
Description:
When inserting into a join view, one of the tables of the view is selected as the table for insertion.
But EXPLAIN will always show the first of these tables as the table being inserted into.

How to repeat:
CREATE TABLE t1(a INTEGER);
CREATE TABLE t2(b INTEGER);
CREATE VIEW v AS SELECT * FROM t1 JOIN t2 ON TRUE;
EXPLAIN INSERT INTO v(b) SELECT 1;
[7 Apr 2015 13:44] Paul Dubois
Noted in 5.7.8, 5.8.0 changelogs.

EXPLAIN for INSERT ... SELECT statements into a multiple-table view
always displayed the first table of the view as the table being
inserted into, even if it was not.