| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Jeremy Zawodny | Date: | September 17 2003 3:31am |
| Subject: | Re: Unique Key Violation - How to determine which key | ||
| View as plain text | |||
On Tue, Sep 16, 2003 at 08:25:39PM -0700, Scot Campbell wrote: > I have a table w/ a primary key and 2 additional unique keys. > > How can I determine which key was in error when a key violation occurs > (error=1062)? > > The call is issued from PHP (4.4.3). > > I can retrieve a message w/ mysql_error() which returns "Duplicate entry > 'email@removed' for key 3" > > I'd rather get the name of the unique key, in this case I named it > `IDX_EMAILADDR`. > > Any ideas? Thanks Look at SHOW KEYS or SHOW CREATE TABLE and find the 3rd key. Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <Jeremy@stripped> | http://jeremy.zawodny.com/ MySQL 4.0.15-Yahoo-SMP: up 3 days, processed 102,697,946 queries (378/sec. avg)
| Thread | ||
|---|---|---|
| • Unique Key Violation - How to determine which key | Scot Campbell | 17 Sep |
| • Re: Unique Key Violation - How to determine which key | Jeremy Zawodny | 17 Sep |
| • Permission Problem in OS X | Dietrich Speer | 23 Jan |
| • Re: Permission Problem in OS X | Brent Baisley | 23 Jan |
| • Re: Unique Key Violation - How to determine which key | Scot Campbell | 17 Sep |
| • Re: Unique Key Violation - How to determine which key | Jeremy Zawodny | 17 Sep |
| • Re: Unique Key Violation - How to determine which key | Scot Campbell | 18 Sep |
| • Re: Unique Key Violation - How to determine which key | Jeremy Zawodny | 18 Sep |
| • Re: Unique Key Violation - How to determine which key | Harald Fuchs | 18 Sep |
| • Re: Unique Key Violation - How to determine which key | Scot Campbell | 18 Sep |
| • Re: Unique Key Violation - How to determine which key | Jeremy Zawodny | 18 Sep |
