Bug #65766 | insert/update | ||
---|---|---|---|
Submitted: | 29 Jun 2012 7:08 | Modified: | 29 Jul 2012 10:08 |
Reporter: | chandra kishore | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S5 (Performance) |
Version: | OS: | Windows | |
Assigned to: | CPU Architecture: | Any |
[29 Jun 2012 7:08]
chandra kishore
[29 Jun 2012 7:15]
Valeriy Kravchuk
What exact server version, 5.x.y, are you working with? Please, send exact CREATE TABLE for that start table and data (INSERTs) to demonstrate the problem.
[29 Jun 2012 9:36]
chandra kishore
hi I am using MYSQL5.5.24.0 i created table create table start(name VARCHAR(20),date DATE,time TIME);
[29 Jun 2012 10:08]
Valeriy Kravchuk
You have to define some UNIQUE (or PRIMARY) key on table for this to work. Like this: mysql> create table start(name VARCHAR(20),date DATE,time TIME); Query OK, 0 rows affected (0.27 sec) mysql> alter table start add unique key (name); Query OK, 0 rows affected (0.27 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> insert into start(name,date,time) values('chandra',CURDATE(),CURTIME()) -> ON DUPLICATE KEY -> UPDATE time = CURTIME(); Query OK, 1 row affected (0.06 sec) mysql> select * from start; +---------+------------+----------+ | name | date | time | +---------+------------+----------+ | chandra | 2012-06-29 | 13:07:07 | +---------+------------+----------+ 1 row in set (0.00 sec) mysql> insert into start(name,date,time) values('chandra',CURDATE(),CURTIME()) -> ON DUPLICATE KEY -> UPDATE time = CURTIME(); Query OK, 2 rows affected (0.05 sec) mysql> select * from start; +---------+------------+----------+ | name | date | time | +---------+------------+----------+ | chandra | 2012-06-29 | 13:07:21 | +---------+------------+----------+ 1 row in set (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.5.25 | +-----------+ 1 row in set (0.00 sec)
[30 Jul 2012 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".