Commit 4025e6c
committed
Do not return NULL for error cases in satisfies_hash_partition().
Since this function is used as a CHECK constraint condition,
returning NULL is tantamount to returning TRUE, which would have the
effect of letting in a row that doesn't satisfy the hash condition.
Admittedly, the cases for which this is done should be unreachable
in practice, but that doesn't make it any less a bad idea. It also
seems like a dartboard was used to decide which error cases should
throw errors as opposed to returning NULL.
For the checks for NULL input values, I just switched it to returning
false. There's some argument that an error would be better; but the
case really should be can't-happen in a generated hash constraint,
so it's likely not worth more code for.
For the parent-relation-open-failure case, it seems like we might
as well let relation_open throw an error, instead of having an
impossible-to-diagnose constraint failure.
Back-patch to v11 where this code came in.
Discussion: https://postgr.es/m/24067.1605134819@sss.pgh.pa.us1 parent ad84ecc commit 4025e6c
File tree
2 files changed
+9
-14
lines changed- src
- backend/partitioning
- test/regress/expected
2 files changed
+9
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4684 | 4684 | | |
4685 | 4685 | | |
4686 | 4686 | | |
| 4687 | + | |
| 4688 | + | |
4687 | 4689 | | |
4688 | 4690 | | |
4689 | 4691 | | |
| |||
4708 | 4710 | | |
4709 | 4711 | | |
4710 | 4712 | | |
4711 | | - | |
| 4713 | + | |
4712 | 4714 | | |
4713 | | - | |
| 4715 | + | |
4714 | 4716 | | |
4715 | 4717 | | |
4716 | 4718 | | |
| |||
4740 | 4742 | | |
4741 | 4743 | | |
4742 | 4744 | | |
4743 | | - | |
4744 | | - | |
4745 | | - | |
| 4745 | + | |
4746 | 4746 | | |
4747 | 4747 | | |
4748 | 4748 | | |
4749 | | - | |
4750 | | - | |
| 4749 | + | |
4751 | 4750 | | |
4752 | 4751 | | |
4753 | 4752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 13 | + | |
18 | 14 | | |
19 | 15 | | |
20 | 16 | | |
| |||
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
37 | | - | |
| 33 | + | |
38 | 34 | | |
39 | 35 | | |
40 | 36 | | |
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
44 | | - | |
| 40 | + | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
| |||
0 commit comments