forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdb96be2
committed
Fix handling of BC years in to_date/to_timestamp.
Previously, a conversion such asto_date('-44-02-01','YYYY-MM-DD')would result in '0045-02-01 BC', as the code attempted to interpretthe negative year as BC, but failed to apply the correction neededfor our internal handling of BC years. Fix the off-by-one problem.Also, arrange for the combination of a negative year and anexplicit "BC" marker to cancel out and produce AD. This is howthe negative-century case works, so it seems sane to do likewise.Continue to read "year 0000" as 1 BC. Oracle would throw an error,but we've accepted that case for a long time so I'm hesitant tochange it in a back-patch.Per bug #16419 from Saeed Hubaishan. Back-patch to all supportedbranches.Dar Alathar-Yemen and Tom LaneDiscussion:https://postgr.es/m/16419-d8d9db0a7553f01b@postgresql.org1 parent071b2f7 commitdb96be2
File tree
4 files changed
+71
-2
lines changed- doc/src/sgml
- src
- backend/utils/adt
- test/regress
- expected
- sql
4 files changed
+71
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6234 | 6234 | | |
6235 | 6235 | | |
6236 | 6236 | | |
| 6237 | + | |
| 6238 | + | |
| 6239 | + | |
| 6240 | + | |
| 6241 | + | |
| 6242 | + | |
| 6243 | + | |
| 6244 | + | |
| 6245 | + | |
6237 | 6246 | | |
6238 | 6247 | | |
6239 | 6248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3733 | 3733 | | |
3734 | 3734 | | |
3735 | 3735 | | |
3736 | | - | |
3737 | | - | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
3738 | 3741 | | |
3739 | 3742 | | |
3740 | 3743 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2981 | 2981 | | |
2982 | 2982 | | |
2983 | 2983 | | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
2984 | 3023 | | |
2985 | 3024 | | |
2986 | 3025 | | |
| |||
3168 | 3207 | | |
3169 | 3208 | | |
3170 | 3209 | | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
3171 | 3216 | | |
3172 | 3217 | | |
3173 | 3218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
464 | 475 | | |
465 | 476 | | |
466 | 477 | | |
| |||
529 | 540 | | |
530 | 541 | | |
531 | 542 | | |
| 543 | + | |
532 | 544 | | |
533 | 545 | | |
534 | 546 | | |
| |||
0 commit comments
Comments
(0)