I have the following table:
id | row_2
---------+---------------
1 | {t,NULL}
2 | {NULL}
I want to keep the rows that are either true or NULL and filter out the rows in which the array contains a false value. I did this:
SELECT
*
FROM
my_table t
WHERE
not (false = ANY (t.row_2));
This doesn't work because a comparison with a null value results in null. That is, this...
SELECT not false = any (ARRAY[true, true]);
SELECT not false = any (ARRAY[false, false]);
...outputs true and false respectively (as expected). But this...
SELECT not false = any (ARRAY[true, null]);
...outputs NULL.