Sorry, Simon’s post help track down the problem. SELECT hospitals_id, length(hospitals_id), typeof(hospitals_id) FROM hospitals;
Showed nulls were being inserted into hospitals_id. Bitten by the documented NULLs aren’t unique bug/feature thing. And thank you for clarifying about UNIQUE Neville On 21 Apr 2014, at 12:04, Richard Hipp <d...@sqlite.org> wrote: > On Mon, Apr 21, 2014 at 6:18 AM, Neville Dastur > <nevillebdas...@gmail.com>wrote: > >> I seem to have a strange problem. >> >> I am using the INSERT OR REPLACE INTO syntax on a Sqlite DB running in iOS >> simulator 7.1 (not exactly sure which sqlite version that is) >> >> I have a column defined as hospitals_id TEXT PRIMARY KEY UNIQUE which >> stores a GUID. Hence the text primary key. When I do an INSERT OR REPLACE >> the rows are duplicated. >> > > Can you send a test case? Are you certain that the GUIDs really are > identical? > > > >> >> Google only showed up that UNIQUE needs to be added regardless of the >> column being a PRIMARY KEY. > > > Google is wrong. The UNIQUE is superfluous. PRIMARY KEY always implies > UNIQUE. Always. > > -- > D. Richard Hipp > d...@sqlite.org > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users