Bug #2684 INSERT SELECT Bug When A Field Is Primary

Submitted: 9 Feb 2004 7:38 Modified: 9 Feb 2004 10:31
Reporter: Sameh Attia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:3.23.58 OS:Linux (RedHat Linux)
Assigned to: Dean Ellis CPU Architecture:Any

[9 Feb 2004 7:38] Sameh Attia
Description:
The problem is that when u ve to tables t1 and t2 each has certain columns c1, c2 ..etc and try to insert into t1 select * from t2 any data that unfortunately exist before in the primary field it gives no error at all. It just prints Changed ??, Duplicated: ??, Warnings:??
We expect out put

How to repeat:
Do the following:
create database d1;
create table t1(c1 int primary key);
create table t2(c1 int primary key);
insert into t1(c1) values (1),(2),(3);
insert into t2(c1) values (1),(2),(3);

Here follows the one that generates the bug
insert into t1(c1) select c1 from t2;

If we replace this insert select with
insert into t1(c1) values (1),(2),(3);
an error is generated which is expected.
[9 Feb 2004 10:31] Dean Ellis
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

This is documented in the manual at:

http://www.mysql.com/doc/en/INSERT_SELECT.html

"Prior to MySQL 4.0.1, INSERT ... SELECT implicitly operates in IGNORE mode. As of MySQL 4.0.1, you should specify IGNORE explicitly to ignore records that would cause duplicate-key violations."
[9 Feb 2004 10:39] Sameh Attia
thanx for ur concern but how do I fix this for a 3.23 server?

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

Page generated in 0.050 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.