I was confused behind the reasoning of the following:
SELECT * FROM table WHERE avalue is null
Returns x number of rows where \'avalue\' is
Every halfway decent RDBMS does it the same way, because it's correct.
I am quoting the Postgres manual here:
Ordinary comparison operators yield null (signifying "unknown"), not true or false, when either input is null. For example,
7 = NULLyields null, as does7 <> NULL. When this behavior is not suitable, use theIS [ NOT ] DISTINCT FROMconstructs:expression IS DISTINCT FROM expression expression IS NOT DISTINCT FROM expression
Note that these expressions perform a bit slower than simple expression <> expression comparison.
For boolean values there is also the simpler IS NOT [TRUE | FALSE].
To get what you expected in your second query, write:
SELECT * FROM table WHERE avalue IS NOT TRUE;
SQL Fiddle.