[MDEV-16925] INSERT IGNORE ... ON DUPLICATE KEY UPDATE ... allowed Created: 2018-08-09 Updated: 2018-10-16 Resolved: 2018-10-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation, Parser |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.3.8, 10.2, 10.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Arjen Lentz | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | upstream | ||
| Environment: |
Ubuntu GNU/Linux 18.04 (Bionic Beaver) x64 |
||
| Description |
|
INSERT IGNORE allows an insert to come back with "ok" even if the row already exists. Combining the two makes no sense, and while harmless, perhaps it would be better if the parser were to throw a syntax error for it.
|
| Comments |
| Comment by Arjen Lentz [ 2018-08-09 ] | |||||||||||||||||||||||||||
|
It has been noted that INSERT can chuck errors for reasons other than a duplicate key. One example would be a foreign key check failing, in this case IGNORE would see the INSERT return without error (but without inserting a row, of course). However, when combined with ON DUPLICATE KEY may create an ambiguity. | |||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-09-02 ] | |||||||||||||||||||||||||||
|
IGNORE can also play a role even in a pure duplicate key situation. Consider the following:
I agree the behaviour should be properly documented. | |||||||||||||||||||||||||||
| Comment by Ian Gilfillan [ 2018-10-16 ] | |||||||||||||||||||||||||||
|
This is documented as follows "The IGNORE and DELAYED options are ignored when you use ON DUPLICATE KEY UPDATE." at https://mariadb.com/kb/en/library/insert-on-duplicate-key-update/ |