On Thu, Jun 15, 2006 at 02:23:58PM -0500, Jay Sprenkle wrote: > You might try adding NOT NULL to your column constraints and > a default to an empty string in the create table. > I thought UNIQUE implied NOT NULL but I might be > wrong.
The null handling page http://sqlite.org/nulls.html says that nulls are distinct in a column, but I haven't found that to be the case (this is a test with 3.3.5) create table foo (bar text, baz text, unique(bar, baz)); insert into foo values ('quux', null); insert into foo values ('quux', null); insert into foo values ('quux', null); .header on .null null select * from foo; bar|baz -------- quux|null quux|null quux|null I ended up defining one of my unique key columns that I wanted to be optional as NOT NULL ON CONFLICT REPLACE DEFAULT '', to solve this problem. Dave Cook