At 8:20 -0500 7/26/04, Victor Pendleton wrote:
Have you tried using the last insert id function instead?
SET @backup_id = last_insert_id()

That'll give him the same result. I suspect the problem might be that user variables are not replicated well in MySQL 4.0.x.

Philippe, what version of MySQL are you using?  If 4.0.x, you might
try skipping the SET statement and just refer to LAST_INSERT_ID()
or @@LAST_INSERT_ID() directly in your second INSERT statement.

-----Original Message-----
From: Philippe Poelvoorde
To: [EMAIL PROTECTED]
Sent: 7/26/04 7:03 AM
Subject: Replication script pb

Hi,

We have an environnment with a master and a slave. We run a script every

hour (on the master only) that does something like this to backup some
parameters :
insert into backup(NULL,NULL) VALUES(NULL,NOW())
SET @backup_id = @@LAST_INSERT_ID
INSERT INTO backup_param ( SELECT @backup_id, col1, col2 FROM param)
It works perfectly on the master but the slave stop due to duplicate
entries. the @backup_id do not pass the replication...
any solution to have that script working ?


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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



Reply via email to