Commit 3152bf7
committed
Fix bugs with parsing signed hh:mm and hh:mm:ss fields in interval input.
DecodeInterval() failed to honor the "range" parameter (the special SQL
syntax for indicating which fields appear in the literal string) if the
time was signed. This seems inappropriate, so make it work like the
not-signed case. The inconsistency was introduced in my commit
f867339, which as noted in its log message
was only really focused on making SQL-compliant literals work per spec.
Including a sign here is not per spec, but if we're going to allow it
then it's reasonable to expect it to work like the not-signed case.
Also, remove bogus setting of tmask, which caused subsequent processing to
think that what had been given was a timezone and not an hh:mm(:ss) field,
thus confusing checks for redundant fields. This seems to be an aboriginal
mistake in Lockhart's commit 2cf1642.
Add regression test cases to illustrate the changed behaviors.
Back-patch as far as 8.4, where support for spec-compliant interval
literals was added.
Range problem reported and diagnosed by Amit Kapila, tmask problem by me.1 parent 95e7505 commit 3152bf7
File tree
3 files changed
+43
-6
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+43
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2873 | 2873 | | |
2874 | 2874 | | |
2875 | 2875 | | |
2876 | | - | |
| 2876 | + | |
2877 | 2877 | | |
2878 | 2878 | | |
2879 | 2879 | | |
2880 | 2880 | | |
2881 | 2881 | | |
2882 | 2882 | | |
2883 | | - | |
2884 | | - | |
2885 | | - | |
| 2883 | + | |
| 2884 | + | |
2886 | 2885 | | |
2887 | 2886 | | |
2888 | | - | |
| 2887 | + | |
2889 | 2888 | | |
2890 | 2889 | | |
2891 | 2890 | | |
| |||
2903 | 2902 | | |
2904 | 2903 | | |
2905 | 2904 | | |
2906 | | - | |
2907 | 2905 | | |
2908 | 2906 | | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
2909 | 2913 | | |
2910 | 2914 | | |
2911 | 2915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
548 | 572 | | |
549 | 573 | | |
550 | 574 | | |
| |||
559 | 583 | | |
560 | 584 | | |
561 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
562 | 590 | | |
563 | 591 | | |
564 | 592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
0 commit comments