FIX: Prevent "integer out of range" when merging post timings (#15723)

This commit is contained in:
Gerhard Schlager
2022-01-26 23:34:28 +01:00
committed by GitHub
parent a560f9d44b
commit 1fef96a2e7
2 changed files with 5 additions and 1 deletions

View File

@@ -118,7 +118,7 @@ class UserMerger
"x.post_number = y.post_number"])
sql = <<~SQL
UPDATE post_timings AS t
SET msecs = t.msecs + s.msecs
SET msecs = LEAST(t.msecs::bigint + s.msecs, 2^31 - 1)
FROM post_timings AS s
WHERE t.user_id = :target_user_id AND s.user_id = :source_user_id
AND t.topic_id = s.topic_id AND t.post_number = s.post_number