forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3db322e
committed
Prevent internal overflows in date-vs-timestamp and related comparisons.
The date-vs-timestamp, date-vs-timestamptz, and timestamp-vs-timestamptzcomparators all worked by promoting the first type to the second andthen doing a simple same-type comparison. This works fine, exceptwhen the conversion result is out of range, in which case we throw anentirely avoidable error. The sources of such failures are(a) type date can represent dates much farther in the future thanthe timestamp types can;(b) timezone rotation might cause a just-in-range timestamp value tobecome a just-out-of-range timestamptz value.Up to now we just ignored these corner-case issues, but now we havean actual user complaint (bug #16657 from Huss EL-Sheikh), so let'sdo something about it.It turns out that commit52ad1e6 already built all the necessaryinfrastructure to support error-free comparisons, but neglected toactually use it in the main-line code paths. Fix that, do a littlebit of code style review, and remove the now-duplicate logic injsonpath_exec.c.Back-patch to v13 where52ad1e6 came in. We could take this backfurther by back-patching said infrastructure, but given the smallnumber of complaints so far, I don't feel a great need to.Discussion:https://postgr.es/m/16657-cde2f876d8cc7971@postgresql.org1 parent6c05e5b commit3db322e
File tree
7 files changed
+260
-252
lines changed- src
- backend/utils/adt
- include/utils
- test/regress
- expected
- sql
7 files changed
+260
-252
lines changed0 commit comments
Comments
(0)