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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.063 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.