Repository navigation
Commit f5635c2
Richard Guo
Fix expr_is_nonnullable() for IS DISTINCT FROM
Commit c8d2f68 taught expr_is_nonnullable() to treat a DistinctExpr
as never returning NULL. That is wrong: when neither input is NULL,
the result is NULL if the underlying equality operator returns NULL,
which nothing forbids. This could lead to wrong query results.
To fix, remove the DistinctExpr case, along with its test case.
While at it, test the relkind before calling has_subclass() in
var_is_nonnullable(), to avoid a useless syscache lookup for
partitioned tables.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CA+TgmoaLcsmc9weJr1yo1X1SwZJX1t4XXHj0SJzH8XztmN9Hdg@mail.gmail.com
Backpatch-through: 191 parent 91f7521 commit f5635c2
3 files changed
Lines changed: 2 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4950 | 4950 | | |
4951 | 4951 | | |
4952 | 4952 | | |
4953 | | - | |
4954 | | - | |
| 4953 | + | |
| 4954 | + | |
4955 | 4955 | | |
4956 | 4956 | | |
4957 | 4957 | | |
| |||
5100 | 5100 | | |
5101 | 5101 | | |
5102 | 5102 | | |
5103 | | - | |
5104 | | - | |
5105 | | - | |
5106 | | - | |
5107 | | - | |
5108 | | - | |
5109 | | - | |
5110 | | - | |
5111 | 5103 | | |
5112 | 5104 | | |
5113 | 5105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | 614 | | |
625 | 615 | | |
626 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 302 | | |
307 | 303 | | |
308 | 304 | | |
| |||
0 commit comments