Postgresql – Why does null and true evaluate to null but null or true evaluates to true

nullpostgresql

Why does null and true evaluate to null in PostgreSQL but null or true evaluates to true?

I would have thought using null with and or or would've evaluated to null in both cases?

Best Answer

  • OR is defined that if either side is true the expression evaluates to true.
  • AND is defined such that if both sides are true boolean-3VL context, the expression evaluates to true;
  • null is not true.