Bug #9398 CREATE TABLE that uses SELECT from a multi-table view causes a crash of server
Submitted: 25 Mar 2005 5:35 Modified: 12 Apr 2005 2:34
Reporter: Igor Babaev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 OS:Any (*)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[25 Mar 2005 5:35] Igor Babaev
Description:
Any statement of the form:
CREATE TABLE T SELECT * FROM V
causes a crash of the server if V is a multi-table view.

How to repeat:
Run the following commands:

CREATE TABLE t1 (a1 int);
CREATE TABLE t2 (a2 int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
INSERT INTO t2 VALUES (1), (2), (3);
CREATE VIEW v1(a,b) AS SELECT a1,a2 FROM t1,t2 ON a1=a2 WHERE a1>1;
SELECT * FROM v1;

Now the command:
CREATE TABLE t3 SELECT * FROM v1;
will cause a crash of the server.
[25 Mar 2005 6:05] Igor Babaev
The correct syntax of the CREATE VIEW command is:
CREATE VIEW v1(a,b) AS SELECT a1,a2 FROM t1 JOIN t2 ON a1=a2 WHERE a1>1;
[28 Mar 2005 12:16] Oleksandr Byelkin
ChangeSet
  1.1845 05/03/28 15:13:31 bell@sanja.is.com.ua +15 -0
  fixed mechanism of detection selection from table wich we update
  (BUG##9398, BUG#8703)
  fixed wrong join view detection in multi-delete which lead to server crash
[3 Apr 2005 20:18] Oleksandr Byelkin
Thank you for bugreport.
Bugfix was pushed into 5.0.4 source tree.
[12 Apr 2005 2:34] Paul Dubois
Noted in 5.0.4 changelog.