-
|
I read that if a column has an index, an UPDATE becomes INSERT + DELETE which could violate primary key constraint. Can someone show me how to update other columns in a table that has a primary key without violating the contraint? For example, here are the table that I'm having problem UPDATING. And if I run the following, it would either complain of foreign key constraint or duplicate key constraint. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 5 replies
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
|
This sounds like it's related to: (Constraints create implicit Indexes) |
Beta Was this translation helpful? Give feedback.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
-
|
Here is the error I'm getting. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
If I remove the foreign key constraints from the other tables, then I get the following error: |
Beta Was this translation helpful? Give feedback.
-
|
Looks like the problem is 'RETURNING invite_code;" portion. |
Beta Was this translation helpful? Give feedback.
-
|
I got the same problem, and I think the messqge is misleading. In my cqse the probleö was that the column I was trying to updqte was incuded in an index. Destroying this index, then committing, then updating and recreating the index made things work. A bit of a hassle though |
Beta Was this translation helpful? Give feedback.
-
|
#7215 talks about this problem. |
Beta Was this translation helpful? Give feedback.
-
|
I'll close this discussion as the remaining issues should've been resolved by #15092. |
Beta Was this translation helpful? Give feedback.
Looks like the problem is 'RETURNING invite_code;" portion.