Bug #8675 INSERT INTO tbl (col,...) SELECT (...) ON DUPLICATE KEY doesn't work properly
Submitted: 22 Feb 2005 10:59 Modified: 22 Feb 2005 20:02
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Any (*)
Assigned to: CPU Architecture:Any

[22 Feb 2005 10:59] jocelyn fournier
Description:
Hi,

When trying to use INSERT INTO tbl_name  (col_name,...) SELECT (...) ON DUPLICATE KEY as describe in the manual, it doesn't work and returns an error.

Regards,
  Jocelyn

How to repeat:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a tinyint, b smallint, primary key (a));
INSERT INTO t1 (a, b) SELECT 1,1 ON DUPLICATE KEY UPDATE b = 2;

=> 
ERROR 1110 (42000): Column 'b' specified twice

However 

INSERT INTO t1 SELECT 1,1 ON DUPLICATE KEY UPDATE b = 2;

works properly
[22 Feb 2005 20:02] Sergei Golubchik
looks like a duplicate of http://bugs.mysql.com/8147