forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita4faef8
committed
Fix some corner cases for window ranges with infinite offsets.
Many situations where the offset is infinity were not handled sanely.We should generally allow the val versus base +/- offset comparison toproceed according to the normal rules of IEEE arithmetic; however, wemust do something special for the corner cases where base +/- offsetwould produce NaN due to subtracting two like-signed infinities.That corresponds to asking which values infinitely precede +inf orinfinitely follow -inf, which should certainly be true of any finitevalue or of the opposite-signed infinity. After some discussion itseems that the best decision is to make it true of the same-signedinfinity as well, ie, just return constant TRUE if the calculationwould produce a NaN.(We could write this with a bit less code by subtracting anyway,and then checking for a NaN result. However, I prefer thisformulation because it'll be easier to transpose into numeric.c.)Although this seems like clearly a bug fix with respect to finitevalues, it is less obviously correct for infinite values. Betweenthat and the fact that the whole issue only arises for very strangewindow specifications (e.g. RANGE BETWEEN 'inf' PRECEDING AND 'inf'PRECEDING), I'll desist from back-patching.Noted by Dean Rasheed.Discussion:https://postgr.es/m/3393130.1594925893@sss.pgh.pa.us1 parent4fb6aeb commita4faef8
File tree
3 files changed
+118
-16
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+118
-16
lines changedLines changed: 30 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1088 | 1088 |
| |
1089 | 1089 |
| |
1090 | 1090 |
| |
1091 |
| - | |
1092 |
| - | |
1093 |
| - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1094 | 1102 |
| |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 |
| - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1099 | 1106 |
| |
1100 | 1107 |
| |
1101 | 1108 |
| |
1102 |
| - | |
| 1109 | + | |
1103 | 1110 |
| |
1104 | 1111 |
| |
1105 | 1112 |
| |
| |||
1157 | 1164 |
| |
1158 | 1165 |
| |
1159 | 1166 |
| |
1160 |
| - | |
1161 |
| - | |
1162 |
| - | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1163 | 1178 |
| |
1164 |
| - | |
1165 |
| - | |
1166 |
| - | |
1167 |
| - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1168 | 1182 |
| |
1169 | 1183 |
| |
1170 | 1184 |
| |
1171 |
| - | |
| 1185 | + | |
1172 | 1186 |
| |
1173 | 1187 |
| |
1174 | 1188 |
| |
|
Lines changed: 72 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1936 | 1936 |
| |
1937 | 1937 |
| |
1938 | 1938 |
| |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
1939 | 1975 |
| |
1940 | 1976 |
| |
1941 | 1977 |
| |
| |||
1995 | 2031 |
| |
1996 | 2032 |
| |
1997 | 2033 |
| |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
1998 | 2070 |
| |
1999 | 2071 |
| |
2000 | 2072 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
524 | 524 |
| |
525 | 525 |
| |
526 | 526 |
| |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
527 | 535 |
| |
528 | 536 |
| |
529 | 537 |
| |
| |||
541 | 549 |
| |
542 | 550 |
| |
543 | 551 |
| |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
544 | 560 |
| |
545 | 561 |
| |
546 | 562 |
| |
|
0 commit comments
Comments
(0)