On 2 May 2017, at 1:35am, Stephen Chrzanowski <pontia...@gmail.com> wrote:
> I was just looking at the ticket, and was wondering if that actually is the > right answer? > > Does REPLACE do an actual INSERT regardless if the PK exists? Doesn't it > search and and update? If NULL is the key, wouldn't it do a search for PK > of NULL (Doesn't exist) and replace that, essentially becoming a NO-OP? REPLACE is short for INSERT OR REPLACE. INSERT OR REPLACE, where the new record is a duplicate, does a DELETE and then an INSERT. In other words, there’s a short time when the old record has been deleted but the new record hasn’t been inserted yet. The result is not the same as if SQLite did an UPDATE instead. An additional complication is that for some purposes SQLite considers that two different NULLs are not the same value. But not all purposes. So you have to know exactly what you’re doing if you’re messing with NULL values in primary keys. <https://sqlite.org/nulls.html> Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users