forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd85ce01
committed
Improve handling of date_trunc() units for infinite input values
Previously, if an infinite value was passed to date_trunc(), then thesame infinite value would always be returned regardless of the fieldunit given by the caller. This commit updates the function so that anerror is returned when an invalid unit is passed to date_trunc() with aninfinite value.This matches the behavior of date_trunc() with a finite value anddate_part() with an infinite value, making the handling of interval,timestamp and timestamptz more consistent across the board for these twofunctions.Some tests are added to cover all these new failure cases, with anunsupported unit and infinite values for the three data types. Therewere no test cases in core that checked all these patterns up to now.Author: Joseph KoshakowDiscussion:https://postgr.es/m/CAAvxfHc4084dGzEJR0_pBZkDuqbPGc5wn7gK_M0XR_kRiCdUJQ@mail.gmail.com1 parent61cac71 commitd85ce01
File tree
7 files changed
+131
-19
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
7 files changed
+131
-19
lines changedLines changed: 102 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4620 | 4620 |
| |
4621 | 4621 |
| |
4622 | 4622 |
| |
4623 |
| - | |
4624 |
| - | |
4625 |
| - | |
4626 | 4623 |
| |
4627 | 4624 |
| |
4628 | 4625 |
| |
| |||
4631 | 4628 |
| |
4632 | 4629 |
| |
4633 | 4630 |
| |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
| 4659 | + | |
| 4660 | + | |
| 4661 | + | |
| 4662 | + | |
| 4663 | + | |
4634 | 4664 |
| |
4635 | 4665 |
| |
4636 | 4666 |
| |
| |||
4836 | 4866 |
| |
4837 | 4867 |
| |
4838 | 4868 |
| |
| 4869 | + | |
| 4870 | + | |
| 4871 | + | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
| 4877 | + | |
| 4878 | + | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
| 4896 | + | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
4839 | 4903 |
| |
4840 | 4904 |
| |
4841 | 4905 |
| |
| |||
4966 | 5030 |
| |
4967 | 5031 |
| |
4968 | 5032 |
| |
4969 |
| - | |
4970 |
| - | |
4971 |
| - | |
4972 | 5033 |
| |
4973 | 5034 |
| |
4974 | 5035 |
| |
| |||
4986 | 5047 |
| |
4987 | 5048 |
| |
4988 | 5049 |
| |
4989 |
| - | |
4990 |
| - | |
4991 |
| - | |
4992 |
| - | |
4993 |
| - | |
4994 |
| - | |
4995 |
| - | |
4996 | 5050 |
| |
4997 | 5051 |
| |
4998 | 5052 |
| |
| |||
5020 | 5074 |
| |
5021 | 5075 |
| |
5022 | 5076 |
| |
5023 |
| - | |
5024 |
| - | |
5025 |
| - | |
5026 |
| - | |
5027 |
| - | |
5028 |
| - | |
5029 | 5077 |
| |
5030 | 5078 |
| |
5031 | 5079 |
| |
| |||
5034 | 5082 |
| |
5035 | 5083 |
| |
5036 | 5084 |
| |
| 5085 | + | |
| 5086 | + | |
| 5087 | + | |
| 5088 | + | |
| 5089 | + | |
| 5090 | + | |
| 5091 | + | |
| 5092 | + | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
| 5100 | + | |
| 5101 | + | |
| 5102 | + | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
5037 | 5120 |
| |
5038 | 5121 |
| |
5039 | 5122 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2219 | 2219 |
| |
2220 | 2220 |
| |
2221 | 2221 |
| |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
2222 | 2231 |
| |
2223 | 2232 |
| |
2224 | 2233 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
591 | 591 |
| |
592 | 592 |
| |
593 | 593 |
| |
| 594 | + | |
| 595 | + | |
594 | 596 |
| |
595 | 597 |
| |
596 | 598 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
701 | 701 |
| |
702 | 702 |
| |
703 | 703 |
| |
| 704 | + | |
| 705 | + | |
704 | 706 |
| |
705 | 707 |
| |
706 | 708 |
| |
| |||
719 | 721 |
| |
720 | 722 |
| |
721 | 723 |
| |
| 724 | + | |
| 725 | + | |
722 | 726 |
| |
723 | 727 |
| |
724 | 728 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
776 | 776 |
| |
777 | 777 |
| |
778 | 778 |
| |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
779 | 787 |
| |
780 | 788 |
| |
781 | 789 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
| 179 | + | |
| 180 | + | |
179 | 181 |
| |
180 | 182 |
| |
181 | 183 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
200 | 200 |
| |
201 | 201 |
| |
202 | 202 |
| |
| 203 | + | |
203 | 204 |
| |
204 | 205 |
| |
205 | 206 |
| |
206 | 207 |
| |
| 208 | + | |
| 209 | + | |
| 210 | + | |
207 | 211 |
| |
208 | 212 |
| |
209 | 213 |
| |
|
0 commit comments
Comments
(0)