Bug #65375 INSERT-SELECT inserts only last row from SELECT statement
Submitted: 20 May 2012 22:46 Modified: 21 Jun 2012 4:02
Reporter: nre nre Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:5.5.16 OS:Windows
Assigned to: CPU Architecture:Any
Tags: INSERT-SELECT failure

[20 May 2012 22:46] nre nre
Description:
Following syntax has unexpected behaviour:

insert into xxx (aaa) select yyy from zzz;

It iserts only part of the whole selected data

How to repeat:
I've created 2 tables:

Table 1:
		CREATE TABLE IF NOT EXISTS `registered_users`
		(	
			`user`	VARCHAR(16)	NOT NULL,
			PRIMARY KEY	(`user`),
			UNIQUE KEY (`user`)
		) 
		ENGINE=InnoDB

Table 2:        CREATE TABLE IF NOT EXISTS `registered_commands`
		(	
			`cmd`			VARCHAR(8)	NOT NULL,
			`x`				INT NOT NULL,
			`y`				INT NOT NULL,
			`str`			BLOB DEFAULT NULL,
			`src_user`		VARCHAR(16)	NOT NULL,
			`dest_user`		VARCHAR(16)	NOT NULL
		) 
		ENGINE=InnoDB

I've inserted 2 values in table1: "usr1" and "usr2". 
Then if I call:

                insert into registered_commands (cmd,x,y,src_user,dest_user) select 'cmd1',0,1,'test',user from registered_users;

MySQL returns the following status:

    Query OK, 2 rows affected (0.09 sec)
    Records: 2  Duplicates: 0  Warnings: 0

but the inserted row is only the second one of the expected 2 rows.
[21 May 2012 4:02] Valeriy Kravchuk
Please, check if the same problem still happens with a newer version, 5.5.24.
[22 Jun 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".