mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
fix crash with non const scale in toDecimal()
This commit is contained in:
parent
db2d65939c
commit
19a69004f0
@ -784,6 +784,9 @@ public:
|
||||
}
|
||||
else if constexpr (to_decimal)
|
||||
{
|
||||
if (!arguments[1].column)
|
||||
throw Exception("Second argument for function " + getName() + " must be constant", ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
||||
UInt64 scale = extractToDecimalScale(arguments[1]);
|
||||
|
||||
if constexpr (std::is_same_v<Name, NameToDecimal32>)
|
||||
|
@ -239,4 +239,8 @@ SELECT toUInt64('2147483649') AS x, toDecimal32(x, 0); -- { serverError 407 }
|
||||
SELECT toUInt64('9223372036854775807') AS x, toDecimal64(x, 0);
|
||||
SELECT toUInt64('9223372036854775809') AS x, toDecimal64(x, 0); -- { serverError 407 }
|
||||
|
||||
SELECT toDecimal32(0, rowNumberInBlock()); -- { serverError 44 }
|
||||
SELECT toDecimal64(0, rowNumberInBlock()); -- { serverError 44 }
|
||||
SELECT toDecimal128(0, rowNumberInBlock()); -- { serverError 44 }
|
||||
|
||||
DROP TABLE IF EXISTS test.decimal;
|
||||
|
Loading…
Reference in New Issue
Block a user