Why would I get a duplicate key error when updating a row?

Posted by hdx on Stack Overflow See other posts from Stack Overflow or by hdx
Published on 2010-06-09T00:20:00Z Indexed on 2010/06/09 0:32 UTC
Read the original article Hit count: 331

Filed under:
|
|
|

I'm using postgres and I'm getting the duplicate key error when updating a row:

cursor.execute("UPDATE jiveuser SET userenabled = 0 WHERE userid = %s" % str(userId))
psycopg2.IntegrityError: duplicate key value violates unique constraint "jiveuser_pk"

I don't understand how updating a row can cause this error... any help will be much appreciated.

© Stack Overflow or respective owner

Related posts about sql

Related posts about error