Bug #30146 | on duplicate key update does insert and update at the same time | ||
---|---|---|---|
Submitted: | 31 Jul 2007 12:59 | Modified: | 31 Jul 2007 13:10 |
Reporter: | Kristian Koehntopp | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
Version: | 5.0.42-enterprise-gpl | OS: | Any |
Assigned to: | Dean Ellis | CPU Architecture: | Any |
[31 Jul 2007 12:59]
Kristian Koehntopp
[31 Jul 2007 13:08]
Kristian Koehntopp
root on mysql.sock [kris]> select * from pkexample; +----+------+-------------+ | id | uniq | val | +----+------+-------------+ | 1 | 1 | neu und neu | | 2 | 2 | zwei | +----+------+-------------+ 2 rows in set (0.00 sec) root on mysql.sock [kris]> insert into pkexample values (3, 1, "neu") on duplicate key update val = concat(values(val), " und neu"); Query OK, 0 rows affected (0.00 sec) root on mysql.sock [kris]> select * from pkexample; +----+------+-------------+ | id | uniq | val | +----+------+-------------+ | 1 | 1 | neu und neu | | 2 | 2 | zwei | +----+------+-------------+ 2 rows in set (0.00 sec)
[31 Jul 2007 13:10]
Kristian Koehntopp
15:09 Isotopp> dean: ah ok, i understand that one as well. 15:09 Isotopp> dean: the values(val) produces "neu", because that is the value that had been inserted had the insert worked. 15:09 Isotopp> dean: the concat then produces the value that is already there 15:09 Isotopp> dean and 0 rows affected is only logical. 15:10 Isotopp> dean: ok, so it "works".