I have a table with four columns, the first three of which are combined into a unique key:


create table Test { cid int(9) NOT NULL default '0', sid int(9) NOT NULL default '0', uid int(9) NOT NULL default '0', rating tinyint(1) NOT NULL default '0', UNIQUE KEY csu1 (cid,sid,uid), KEY cid1 (sid), KEY sid1 (sid), KEY uid1 (sid), } TYPE=InnoDB;


I am using a REPLACE query to insert a row if it doesn't exist and replace an existing row if one does exist:


REPLACE into TEST (cid, sid, uid, rating) values (580, 0, 205, 1)

In the case of this particular row, a row already exists with the concatenated key of 580-0-205 and I am getting a duplicate key error. I thought REPLACE was supposed to actually replace the contents of the row if one exists. Does anyone have any ideas as to why this would be causing a duplicate key error?

Thanks,

Kevin

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



Reply via email to