问题 I came up against a strange problem in Postgres yesterday when trying to filter out user ids from a stats table. When we did, for example, user_id != 24 , postgres excluded the rows where user_id is NULL as well. I created the following test code which shows the same results. CREATE TEMPORARY TABLE test1 ( id int DEFAULT NULL ); INSERT INTO test1 (id) VALUES (1), (2), (3), (4), (5), (2), (4), (6), (4), (7), (5), (9), (5), (3), (6), (4), (3), (7), (NULL), (NULL), (NULL), (NULL), (NULL), (NULL)