Yep. What most people want is an INSERT OR UPDATE. -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Petite Abeille Sent: Tuesday, September 24, 2013 1:48 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement
On Sep 23, 2013, at 6:19 PM, Jean-Marie CUAZ <jm.c...@orens.fr> wrote: > -> no exception is raised to host langage Tcl for 2 rows not inserted > -> because a UNIQUE constraint is not respected partial execution : 2 > -> rows are definitely deleted from the table ...(ouch !) Yep. Looks like it does exactly what it says on the tin: "When a UNIQUE constraint violation occurs, the REPLACE algorithm deletes pre-existing rows that are causing the constraint violation prior to inserting or updating the current row and the command continues executing normally. If a NOT NULL constraint violation occurs, the REPLACE conflict resolution replaces the NULL value with the default value for that column, or if the column has no default value, then the ABORT algorithm is used. If a CHECK constraint violation occurs, the REPLACE conflict resolution algorithm always works like ABORT." http://www.sqlite.org/lang_conflict.html Usually... with insight... 'replace' is rarely what one really wants. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users This email and any attachments are only for use by the intended recipient(s) and may contain legally privileged, confidential, proprietary or otherwise private information. Any unauthorized use, reproduction, dissemination, distribution or other disclosure of the contents of this e-mail or its attachments is strictly prohibited. If you have received this email in error, please notify the sender immediately and delete the original. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users