List:General Discussion« Previous MessageNext Message »
From:Emmett Bishop Date:April 14 2004 3:46pm
Subject:Re: REPLACE query
View as plain text  
I ran into this problem when I installed 4.0.18. All
of the tables in my database are INNODB and the
REPLACE statement was failing on tables that had
foreign key constraints. I just rolled back to 4.0.16
and the problems went away. Not much of a solution,
but it's buying me a little time. Will I have to get
rid of all of the REPLACE INTO statements and replace
them with INSERT/UPDATE statements or is there some
configuration setting that needs to be changed to make
it work?

Cheers,

Tripp

--- Victoria Reznichenko
<victoria.reznichenko@stripped> wrote:
> Kevin Carlson <khcarlso@stripped> wrote:
> > 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?
> > 
> 
> Works fine for me. The above CREATE TABLE statement
> has some syntax errors. What exactly does CREATE
> TABLE look like?
> What version of MySQL do you use?
> 
> 
> -- 
> For technical support contracts, goto
> https://order.mysql.com/?ref=ensita
> This email is sponsored by Ensita.net
> http://www.ensita.net/
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
>  / /|_/ / // /\ \/ /_/ / /__  
> Victoria.Reznichenko@stripped
> /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
>        <___/   www.mysql.com
> 
> 
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/mysql?unsub=1
> 



	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
Thread
REPLACE queryKevin Carlson14 Apr
  • Re: REPLACE queryVictoria Reznichenko14 Apr
    • Re: REPLACE queryEmmett Bishop14 Apr
      • Re: REPLACE queryVictoria Reznichenko14 Apr
        • key_buffer_size and INNODBEmmett Bishop19 Apr
          • Re: key_buffer_size and INNODBPaul DuBois20 Apr