aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-02-28 14:00:30 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2024-02-28 14:00:30 -0500
commitd163fdbfea82a5a578de5bc6392ae84c590bb454 (patch)
treedc068a85e07d1e6908a960e8e2210bfb06fe0577 /src/backend/executor/nodeModifyTable.c
parent53c2a97a92665be6bd7d70bd62ae6158fe4db96e (diff)
downloadpostgresql-d163fdbfea82a5a578de5bc6392ae84c590bb454.tar.gz
postgresql-d163fdbfea82a5a578de5bc6392ae84c590bb454.zip
Fix mis-rounding and overflow hazards in date_bin().
In the case where the target timestamp is before the origin timestamp and their difference is already an exact multiple of the stride, the code incorrectly subtracted the stride anyway. Also detect several integer-overflow cases that previously produced bogus results. (The submitted patch tried to avoid overflow, but I'm not convinced it's right, and problematic cases are so far out of the plausibly-useful range that they don't seem worth sweating over. Let's just use overflow-detecting arithmetic and throw errors.) timestamp_bin() and timestamptz_bin() are basically identical and so had identical bugs. Fix both. Report and patch by Moaaz Assali, adjusted some by me. Back-patch to v14 where date_bin() was introduced. Discussion: https://postgr.es/m/CALkF+nvtuas-2kydG-WfofbRSJpyODAJWun==W-yO5j2R4meqA@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
0 files changed, 0 insertions, 0 deletions