boringSQL | Supercharge your SQL & PostgreSQL powers · Jun 14, 2026
The NULL in your NOT IN
0Sign in to vote or save
This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
A NOT IN query can return the wrong answer without telling you. It is valid SQL, it runs without an error, and it hands back a perfectly well-formed result set that happens to be empty when it should not be. No warning, no hint, nothing in the logs: just zero rows where you expected hundreds, and a database that considers it correct. Almost always the cause is a single NULL sitting somewhere you…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.