List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:June 4 1999 2:14am
Subject:REPLACE INTO fails after mysqladmin refresh
View as plain text  
>>>>> "Brian" == Brian Moon <brian@stripped> writes:

>> Description:
Brian>         REPLACE INTO fails after mysqladmin refresh

>> How-To-Repeat:

Brian>         CREATE TABLE bug ( seq char(1) DEFAULT '' NOT NULL, nextval
Brian> bigint(20) unsigned DEFAULT '0' NOT NULL auto_increment, PRIMARY KEY (seq) )
Brian>         UPDATE bug set nextval='71';
Brian>         SELECT * from bug;
Brian>         +-----+---------+
Brian>         | seq | nextval |
Brian>         +-----+---------+
Brian>         |     |      71 |
Brian>         +-----+---------+
Brian>         1 row in set (0.01 sec)

Brian>         REPLACE INTO bug values (' ', nextval+1);
Brian>         Query OK, 2 rows affected (0.01 sec)
Brian>         SELECT * from bug;
Brian>         +-----+---------+
Brian>         | seq | nextval |
Brian>         +-----+---------+
Brian>         |     |      72 |
Brian>         +-----+---------+
Brian>         1 row in set (0.00 sec)

mysql> exit
Brian>         $ mysqladmin refresh
Brian>         $ mysql db
Brian>         REPLACE INTO bug values (' ', nextval+1);
Brian>         Query OK, 2 rows affected (0.01 sec)
Brian>         SELECT * from bug;
Brian>         +-----+---------+
Brian>         | seq | nextval |
Brian>         +-----+---------+
Brian>         |     |       1 |
Brian>         +-----+---------+
Brian>         1 row in set (0.00 sec)

>> Fix:
Brian>         current work around is to do a SELECT on the table before doing the
Brian> REPLACE.  That seems to make it work.

The problem is that nextval isn't properly initialized;  This will be
fixed in MySQL 3.23

Regards,
Monty
Thread
REPLACE INTO fails after mysqladmin refreshBrian Moon3 Jun
  • REPLACE INTO fails after mysqladmin refreshMichael Widenius4 Jun