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.
The error would seem to indicate that the
userenabledcolumn is participating in thejiveuser_pkprimary key. My guess is that bothuseridanduserenabledparticipate in the primary key, and that you’ve already auseridwhereuserenabledis equal to zero.