Description:
INSERT ... SELECT duplicate key reports the source table instead of the target on NDB engine, and on InnoDB it reports the correct warning.
How to repeat:
SET SESSION sql_mode='';
CREATE TABLE src (id INT PRIMARY KEY, v INT) ENGINE=NDB;
CREATE TABLE t (id INT PRIMARY KEY, v INT) ENGINE=NDB;
INSERT INTO src VALUES (1,10),(2,20);
INSERT INTO t VALUES (7,111);
INSERT INTO t SELECT 7, v FROM src;
-- ERROR 1062 (23000): Duplicate entry '0' for key 'src.PRIMARY'
-- here the table in ERROR is src
DROP TABLE src;
DROP TABLE t;
CREATE TABLE src (id INT PRIMARY KEY, v INT) ENGINE=InnoDB;
CREATE TABLE t (id INT PRIMARY KEY, v INT) ENGINE=InnoDB;
INSERT INTO src VALUES (1,10),(2,20);
INSERT INTO t VALUES (7,111);
INSERT INTO t SELECT 7, v FROM src;
-- ERROR 1062 (23000): Duplicate entry '7' for key 't.PRIMARY'
-- here the table in ERROR is t