- Notifications
You must be signed in to change notification settings - Fork5
Commitf867339
committed
Make our parsing of INTERVAL literals spec-compliant (or at least a heck of
a lot closer than it was before). To do this, tweak coerce_type() to passthrough the typmod information when invoking interval_in() on an UNKNOWNconstant; then fix DecodeInterval to pay attention to the typmod when decidinghow to interpret a units-less integer value. I changed one or two otherdetails as well. I believe the code now reacts as expected by spec for allthe literal syntaxes that are specifically enumerated in the spec. Thereare corner cases involving strings that don't exactly match the set of fieldscalled out by the typmod, for which we might want to tweak the behavior somemore; but I think this is an area of user friendliness rather than speccompliance. There remain some non-compliant details about the SQL syntax(as opposed to what's inside the literal string); but at least we'll throwerror rather than silently doing the wrong thing in those cases.1 parent3b9ec46 commitf867339
File tree
7 files changed
+296
-30
lines changed- src
- backend
- parser
- utils/adt
- include/utils
- test/regress
- expected
- sql
7 files changed
+296
-30
lines changedLines changed: 22 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
| 182 | + | |
182 | 183 |
| |
183 | 184 |
| |
184 | 185 |
| |
| |||
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
193 |
| - | |
| 194 | + | |
194 | 195 |
| |
195 | 196 |
| |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
196 | 211 |
| |
197 | 212 |
| |
198 | 213 |
| |
199 |
| - | |
| 214 | + | |
200 | 215 |
| |
201 | 216 |
| |
202 | 217 |
| |
| |||
215 | 230 |
| |
216 | 231 |
| |
217 | 232 |
| |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 | 233 |
| |
224 | 234 |
| |
225 | 235 |
| |
226 | 236 |
| |
227 | 237 |
| |
228 | 238 |
| |
229 |
| - | |
| 239 | + | |
230 | 240 |
| |
231 |
| - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
232 | 244 |
| |
233 | 245 |
| |
234 | 246 |
| |
|
Lines changed: 73 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
38 |
| - | |
39 |
| - | |
| 38 | + | |
| 39 | + | |
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| |||
832 | 832 |
| |
833 | 833 |
| |
834 | 834 |
| |
835 |
| - | |
| 835 | + | |
| 836 | + | |
836 | 837 |
| |
837 | 838 |
| |
838 | 839 |
| |
| |||
1563 | 1564 |
| |
1564 | 1565 |
| |
1565 | 1566 |
| |
| 1567 | + | |
1566 | 1568 |
| |
1567 | 1569 |
| |
1568 | 1570 |
| |
| |||
2224 | 2226 |
| |
2225 | 2227 |
| |
2226 | 2228 |
| |
2227 |
| - | |
| 2229 | + | |
| 2230 | + | |
2228 | 2231 |
| |
2229 | 2232 |
| |
2230 | 2233 |
| |
| |||
2245 | 2248 |
| |
2246 | 2249 |
| |
2247 | 2250 |
| |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
2248 | 2258 |
| |
2249 | 2259 |
| |
2250 | 2260 |
| |
| |||
2705 | 2715 |
| |
2706 | 2716 |
| |
2707 | 2717 |
| |
2708 |
| - | |
| 2718 | + | |
| 2719 | + | |
2709 | 2720 |
| |
2710 | 2721 |
| |
2711 | 2722 |
| |
| |||
2734 | 2745 |
| |
2735 | 2746 |
| |
2736 | 2747 |
| |
2737 |
| - | |
| 2748 | + | |
| 2749 | + | |
2738 | 2750 |
| |
2739 | 2751 |
| |
2740 | 2752 |
| |
| |||
2757 | 2769 |
| |
2758 | 2770 |
| |
2759 | 2771 |
| |
2760 |
| - | |
| 2772 | + | |
| 2773 | + | |
2761 | 2774 |
| |
2762 | 2775 |
| |
2763 | 2776 |
| |
| |||
2796 | 2809 |
| |
2797 | 2810 |
| |
2798 | 2811 |
| |
2799 |
| - | |
| 2812 | + | |
2800 | 2813 |
| |
2801 | 2814 |
| |
2802 | 2815 |
| |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
2803 | 2852 |
| |
2804 | 2853 |
| |
2805 | 2854 |
| |
2806 | 2855 |
| |
2807 | 2856 |
| |
2808 |
| - | |
2809 |
| - | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
2810 | 2861 |
| |
2811 |
| - | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
2812 | 2872 |
| |
2813 | 2873 |
| |
2814 | 2874 |
| |
| |||
2896 | 2956 |
| |
2897 | 2957 |
| |
2898 | 2958 |
| |
| 2959 | + | |
2899 | 2960 |
| |
2900 | 2961 |
| |
2901 | 2962 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
632 | 632 |
| |
633 | 633 |
| |
634 | 634 |
| |
635 |
| - | |
| 635 | + | |
| 636 | + | |
636 | 637 |
| |
637 | 638 |
| |
638 | 639 |
| |
|
Lines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
604 | 604 |
| |
605 | 605 |
| |
606 | 606 |
| |
| 607 | + | |
607 | 608 |
| |
608 | 609 |
| |
609 | 610 |
| |
| |||
617 | 618 |
| |
618 | 619 |
| |
619 | 620 |
| |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
620 | 626 |
| |
621 | 627 |
| |
622 | 628 |
| |
623 |
| - | |
| 629 | + | |
624 | 630 |
| |
625 | 631 |
| |
626 | 632 |
| |
| |||
945 | 951 |
| |
946 | 952 |
| |
947 | 953 |
| |
948 |
| - | |
| 954 | + | |
949 | 955 |
| |
950 | 956 |
| |
951 | 957 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
12 |
| - | |
| 12 | + | |
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| |||
290 | 290 |
| |
291 | 291 |
| |
292 | 292 |
| |
293 |
| - | |
| 293 | + | |
294 | 294 |
| |
295 | 295 |
| |
296 | 296 |
| |
|
0 commit comments
Comments
(0)