jeudi 14 janvier 2016

Primary key does not allow unique replace functionality

CREATE TABLE resource_sync (_id INTEGER UNIQUE ON CONFLICT REPLACE PRIMARY KEY, status_id INTEGER, result_id INTEGER);

In case two equal _id values get inserted, SQLite would throw an exception:

[13:39:48] Error while executing SQL query on database 'test': UNIQUE constraint failed: resource_sync._id

However, it allows for desired replaces in case Primary key declaration is removed from table creation sql.

Why is that?

Thanks.

Aucun commentaire:

Enregistrer un commentaire