SQLite Forum

STRICT tables and UNIQUE indices
Login
I think you are mistaken - NULL values are distinct in UNIQUE INDEXes in most RDBMSes, [even in PostGres](https://www.postgresqltutorial.com/postgresql-indexes/postgresql-unique-index/). The only kind of UNIQUE INDEX that should not allow NULLS is a Primary Key (for obvious reasons) unless the field is also declared as NOT NULL, but then no nulls can exist, ditto for SQLite. 

If you run into bugs because of that notion then I'm afraid to say the bugs are your own doing.

One immediate remedy for your situation I can think of is to declare another calculated column with the expressions "COALESCE(my_key,-1)" which will always have the same value as the example "my_key" field, unless that field is NULL in which case it would have the value -1. Declaring a Unique Index on the calculated field should solve your problem (I think, but I haven't yet tried it).