forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita963283
committed
Reject "23:59:60.nnn" in datetime input.
It's intentional that we don't allow values greater than 24 hours,while we do allow "24:00:00" as well as "23:59:60" as inputs.However, the range check was miscoded in such a way that it wouldaccept "23:59:60.nnn" with a nonzero fraction. For time or timetz,the stored result would then be greater than "24:00:00" which wouldfail dump/reload, not to mention possibly confusing other operations.Fix by explicitly calculating the result and making sure it does notexceed 24 hours. (This calculation is redundant with what will happenlater in tm2time or tm2timetz. Maybe someday somebody will find thatannoying enough to justify refactoring to avoid the duplication; butthat seems too invasive for a back-patched bug fix, and the cost isprobably unmeasurable anyway.)Note that this change also rejects such input as the time portionof a timestamp(tz) value.Back-patch to v10. The bug is far older, but to change this pre-v10we'd need to ensure that the logic behaves sanely with float timestamps,which is possibly nontrivial due to roundoff considerations.Doesn't really seem worth troubling with.Per report from Christoph Berg.Discussion:https://postgr.es/m/20200520125807.GB296739@msg.df7cb.de1 parentf506704 commita963283
File tree
8 files changed
+176
-38
lines changed- src
- backend/utils/adt
- include/utils
- test/regress
- expected
- sql
8 files changed
+176
-38
lines changedLines changed: 63 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| 21 | + | |
21 | 22 |
| |
22 | 23 |
| |
23 | 24 |
| |
| |||
1270 | 1271 |
| |
1271 | 1272 |
| |
1272 | 1273 |
| |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1273 | 1333 |
| |
1274 | 1334 |
| |
1275 | 1335 |
| |
| |||
1374 | 1434 |
| |
1375 | 1435 |
| |
1376 | 1436 |
| |
1377 |
| - | |
1378 |
| - | |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
| 1437 | + | |
| 1438 | + | |
1383 | 1439 |
| |
1384 | 1440 |
| |
1385 | 1441 |
| |
1386 | 1442 |
| |
1387 | 1443 |
| |
1388 | 1444 |
| |
1389 | 1445 |
| |
1390 |
| - | |
| 1446 | + | |
1391 | 1447 |
| |
1392 | 1448 |
| |
1393 | 1449 |
| |
|
Lines changed: 5 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
936 | 936 |
| |
937 | 937 |
| |
938 | 938 |
| |
939 |
| - | |
940 |
| - | |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
945 |
| - | |
946 |
| - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
947 | 942 |
| |
948 | 943 |
| |
949 | 944 |
| |
| |||
2218 | 2213 |
| |
2219 | 2214 |
| |
2220 | 2215 |
| |
2221 |
| - | |
2222 |
| - | |
2223 |
| - | |
2224 |
| - | |
2225 |
| - | |
2226 |
| - | |
2227 |
| - | |
2228 |
| - | |
2229 |
| - | |
2230 |
| - | |
| 2216 | + | |
| 2217 | + | |
2231 | 2218 |
| |
2232 | 2219 |
| |
2233 | 2220 |
| |
|
Lines changed: 4 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
35 | 36 |
| |
36 | 37 |
| |
37 | 38 |
| |
| |||
581 | 582 |
| |
582 | 583 |
| |
583 | 584 |
| |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
590 |
| - | |
591 |
| - | |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
| 585 | + | |
| 586 | + | |
596 | 587 |
| |
597 | 588 |
| |
598 | 589 |
| |
599 | 590 |
| |
600 | 591 |
| |
601 | 592 |
| |
602 | 593 |
| |
603 |
| - | |
| 594 | + | |
604 | 595 |
| |
605 | 596 |
| |
606 | 597 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| 83 | + | |
| 84 | + | |
83 | 85 |
| |
84 | 86 |
| |
85 | 87 |
|
Lines changed: 41 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
76 | 117 |
| |
77 | 118 |
| |
78 | 119 |
| |
|
Lines changed: 41 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
93 | 134 |
| |
94 | 135 |
| |
95 | 136 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 |
| |
34 | 44 |
| |
35 | 45 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 |
| |
39 | 49 |
| |
40 | 50 |
| |
|
0 commit comments
Comments
(0)