Hello.
In my opinion, it is not a bug. REPLACE has returned the sum
of affected rows - one was deleted, and one was inserted. See:
http://dev.mysql.com/doc/refman/5.1/en/replace.html
Octavian Rasnita wrote:
> Hi,
>
> I have tried:
>
> mysql> create table z(id int unsigned not null primary key, first_name
> varchar(20), last_name varchar(20));
> Query OK, 0 rows affected (0.06 sec)
> mysql> insert into z values(1, 'John', 'Smith'), (2, 'George',
> 'Washington');
> Query OK, 2 rows affected (0.00 sec)
> Records: 2 Duplicates: 0 Warnings: 0
> mysql> select * from z;
> +----+------------+------------+
> | id | first_name | last_name |
> +----+------------+------------+
> | 1 | John | Smith |
> | 2 | George | Washington |
> +----+------------+------------+
> 2 rows in set (0.00 sec)
> mysql> replace into z values(1, 'Michael', 'Rifle');
> Query OK, 2 rows affected (0.00 sec)
> mysql> select * from z;
> +----+------------+------------+
> | id | first_name | last_name |
> +----+------------+------------+
> | 1 | Michael | Rifle |
> | 2 | George | Washington |
> +----+------------+------------+
> 2 rows in set (0.00 sec)
> mysql>
>
> Is there a bug that MySQL says "Query OK, 2 rows affected (0.00 sec)"
> although only a single row was modified (as it should)?
>
> I am using the version 5.0.15-nt.
>
> Thanks.
>
> Teddy
>
>
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@stripped
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com