From 5ff77e3b5f8fb36435d136404efbe316cd962dba Mon Sep 17 00:00:00 2001 From: zvonand Date: Mon, 25 Jul 2022 10:47:07 +0200 Subject: [PATCH] dumb fix --- src/Core/DecimalFunctions.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/DecimalFunctions.h b/src/Core/DecimalFunctions.h index 331df9aa637..9aaf1ed7b55 100644 --- a/src/Core/DecimalFunctions.h +++ b/src/Core/DecimalFunctions.h @@ -292,7 +292,11 @@ inline auto binaryOpResult(const DecimalType & tx, const DecimalType & ty) if constexpr (is_multiply) scale = tx.getScale() + ty.getScale(); else if constexpr (is_division) + { scale = tx.getScale(); + if (scale * 2 > max_precision) + throw Exception("Overflow during decimal division", ErrorCodes::DECIMAL_OVERFLOW); + } else scale = (tx.getScale() > ty.getScale() ? tx.getScale() : ty.getScale());