correctly encode NULL equality check in postgres