Search code examples
postgresqlpostgis

PostgreSQL: IS NOT NULL statement not working


If I use the statement

SELECT * FROM dump WHERE (x_orig IS NOT NULL) OR (x_dest IS NOT NULL); Not null image result

It does not filter out the null values in the columns I indicate. But when I use the statement SELECT * FROM dump WHERE (x_orig IS NULL) OR (x_dest IS NULL); Null image result

It does filter out the results I actually want to remove.

I try to remove all the rows that have null values in the x coordinate of their origin or destination.


Solution

  • By De Morgan's laws if you want to negate (A OR B) you need to change it to (!A AND !B) instead of (!A OR !B).