zhouqingqing / qpmodel

A Relational Optimizer and Executor
MIT License
66 stars 18 forks source link

# NOT IN subquery Logic #246

Closed 9DemonFox closed 3 years ago

9DemonFox commented 3 years ago

postgres-not-in-null-gives-no-result Whether we have to follow the logic of PostgreSQL ?

zhouqingqing commented 3 years ago

@pkommoju any comments?

pkommoju commented 3 years ago

NULL comparison only works with x IS NULL and x IS NOT NULL. Only in these cases the result is TRUE or FALSE depending on x being NULL or NOT NULL. Every other way of comparing something against NULL results in NULL. This standard SQL and Postgres follows the standard. We should do the same.

pkommoju commented 3 years ago

NULL = NULL is NULL, and so is NULL <> NULL.