dolt icon indicating copy to clipboard operation
dolt copied to clipboard

INSERT IGNORE INTO throws `duplicate unique key given` for keyless tables

Open druvv opened this issue 1 year ago • 2 comments

The correct behavior for INSERT IGNORE INTO when a duplicate unique key is found is to skip the insert that caused the violation. Currently, inserts on a keyless table will always return an error regardless.

Repro:

> dolt sql -q "CREATE TABLE keyless (col1 int UNIQUE);"
> dolt sql -q "INSERT INTO keyless VALUES (1);"
> dolt sql -q "INSERT IGNORE INTO keyless VALUES (1);"
error executing query on line 1: Duplicate entry for key 'col1': duplicate unique key given: [1]

druvv avatar Jul 15 '22 17:07 druvv

The keyless table editor does not return an error for a unique key violation when the row is inserted, but instead returns the error when it is closed.

It needs to return the error when the row is inserted in order for the INSERT IGNORE machinery in GMS to ignore the error correctly. Additionally, some work may be required to implement the associated required checkpointing functionality.

druvv avatar Jul 15 '22 21:07 druvv

This is fixed in the new __DOLT_1__ format.

druvv avatar Jul 18 '22 17:07 druvv

Gonna close as we have it working in the new format.

timsehn avatar Aug 31 '22 17:08 timsehn