List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 17 1999 4:10pm
Subject:Re: ERROR 1062: Duplicate entry '173-P-123' for key 1 (but it UPDATES) ???
View as plain text  
On Thu, 1999-09-16 08:51:17 -0700, Philip Hallstrom wrote:
> But that's my problem... I'm not adding it again.

You do! :)

Because with the SQL query
  UPDATE review_assignments SET reviewer=123  WHERE reviewee=173;
you try to update _all_ matching rows!

This is, with this data ...
  mysql> select * from review_assignments;
  +----------+------+----------+
  | reviewee | type | reviewer |
  +----------+------+----------+
  |      173 | P    |      122 |
  |      173 | P    |      157 |
  +----------+------+----------+
... your UPDATE will try to update _both_ rows.

This is okay for the first row, changing it into 132-P-123.
But the second row can't be updated, because it would become
173-P-123, too -- a duplicate!

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
ERROR 1062: Duplicate entry '173-P-123' for key 1 (but it UPDATES)???Philip Hallstrom16 Sep
  • Re: ERROR 1062: Duplicate entry '173-P-123' for key 1 (but it UPDATES) ???Ricardo T. Saito16 Sep
    • Re: ERROR 1062: Duplicate entry '173-P-123' for key 1 (but it UPDATES)???Philip Hallstrom16 Sep
      • Re: ERROR 1062: Duplicate entry '173-P-123' for key 1 (but it UPDATES) ???Martin Ramsch17 Sep