[MDEV-11277] REPLACE query leads to 'duplicate error for key PRIMARY' mesage, but must be 'foreign key constraint fail'. Created: 2016-11-13 Updated: 2016-11-17 Resolved: 2016-11-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Vasiliy Pyatykh | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider the following example. We just create two tables, second with the foreign key, and our foreign key is also a part of compound primary key of the second table:
Last replace is an error, because the foreign key called fk_t leads to nowhere and thats why new row can't be inserted. But the server behavior varies on MySQL and MariaDB. MySQL says:
and that is correct error message. But MariaDB says:
What? Duplicate entry? But i am using REPLACE query, you should just delete a row and insert again in such a case. The error messsage is wrong and confusing. |
| Comments |
| Comment by Elena Stepanova [ 2016-11-16 ] | ||||||||||||||||||||||||||||
|
Which MariaDB version are you using? I can't reproduce the problem on any of recent 5.5-10.2. Could you please paste the full unabridged output (everything, from CREATE TABLE to SELECT @@version from the client similar to below, showing the wrong error message?
| ||||||||||||||||||||||||||||
| Comment by Vasiliy Pyatykh [ 2016-11-17 ] | ||||||||||||||||||||||||||||
|
sorry for confusion, i have just messed up my db install, it is actually a bug in Percona XtraDB Cluster |