Re: BUG #18999: Equivalent queries processing WHERE IS NULL & WHERE IS NOT NULL produce mutually exclusive results
От | Tom Lane |
---|---|
Тема | Re: BUG #18999: Equivalent queries processing WHERE IS NULL & WHERE IS NOT NULL produce mutually exclusive results |
Дата | |
Msg-id | 1856868.1753450099@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #18999: Equivalent queries processing WHERE IS NULL & WHERE IS NOT NULL produce mutually exclusive results (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #18999: Equivalent queries processing WHERE IS NULL & WHERE IS NOT NULL produce mutually exclusive results
|
Список | pgsql-bugs |
PG Bug reporting form <noreply@postgresql.org> writes: > I think "SELECT COUNT(c0) FROM t0" = "SELECT COUNT(c0) FROM t0 WHERE c0 IS > NOT NULL" + "SELECT COUNT(c0) FROM t0 WHERE c0 IS NULL". This is not so when c0 is composite. Per [1]: If the expression is row-valued, then IS NULL is true when the row expression itself is null or when all the row's fields are null, while IS NOT NULL is true when the row expression itself is non-null and all the row's fields are non-null. Because of this behavior, IS NULL and IS NOT NULL do not always return inverse results for row-valued expressions; in particular, a row-valued expression that contains both null and non-null fields will return false for both tests. Pretty weird, I agree, but that's what the SQL standard says to do. regards, tom lane [1] https://www.postgresql.org/docs/current/functions-comparison.html
В списке pgsql-bugs по дате отправления: