Sorry I forgot to include table-defs: ..

OK, I've got it entirely reproducible now, without giving away any
sensitive data.

No, the column-lengths are the same. But doing this has shown me that
it's something to do with the partial key on the 'email' column in the
'user' table. If you remove it, it stops happening. This is not what I
would have expected - does it make sense?

-----------

  DROP TABLE IF EXISTS customers;
CREATE TABLE `customers` (
  `id` bigint(20) NOT NULL auto_increment,
  `email` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

drop table if exists user;
CREATE TABLE `user` (
  `user_id` int(11) NOT NULL auto_increment,
  `email` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`user_id`),
  KEY `user_id` (`user_id`),
  KEY `email` (`email`(15))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

insert into user (user_id, email)
values 
(    5122 , '[EMAIL PROTECTED]' ),
(    5143 , '[EMAIL PROTECTED]'    );

INSERT INTO customers (id)
SELECT null
  FROM user
  LEFT JOIN user dup_user
    ON dup_user.user_id>user.user_id
   AND user.email=dup_user.email
LIMIT 1;

show warnings;

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to