On Tuesday, 16 February, 2016 20:33. Denis Burke <burkeden at gmail.com> asked:

> I realize that SQLite will handle NULLs according to:
> https://sqlite.org/nulls.html

> As best as I can tell this is a case not listed on that page and gives an
> answer different than I would expect:

What answer do you expect?  Why do you expect that answer?

> select case when null not in ('a') then 'not in list' else 'is in list'
> end;

> This gives "is in list".  But since null is clearly not in the list of one
> member ('a'), I would expect this to generate "not in the list".

Faulty reasoning.  "null in ('a')" is null, and "null not in ('a')" is null -- 
operations with null return null.

null is not a not-zero (true) value (it is not any value, it is null), hence 
the "then" (true) path is not taken.  That leaves the else.

> Is this expected behavior, or a bug?

It is what I would expect.

> Thank you,
> Denis Burke
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



Reply via email to