mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Merge pull request #8764 from 4ertus2/bugs
Fix toDecimalOrNull() with exception inside
This commit is contained in:
commit
289f16978f
@ -101,7 +101,13 @@ inline bool readDigits(ReadBuffer & buf, T & x, unsigned int & digits, int & exp
|
||||
{
|
||||
++buf.position();
|
||||
Int32 addition_exp = 0;
|
||||
readIntText(addition_exp, buf);
|
||||
if (!tryReadIntText(addition_exp, buf))
|
||||
{
|
||||
if constexpr (_throw_on_error)
|
||||
throw Exception("Cannot parse exponent while reading decimal", ErrorCodes::CANNOT_PARSE_NUMBER);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
exponent += addition_exp;
|
||||
stop = true;
|
||||
continue;
|
||||
|
@ -0,0 +1,3 @@
|
||||
\N 1
|
||||
\N 1
|
||||
\N 1
|
@ -0,0 +1,7 @@
|
||||
SELECT toDecimal32('e', 1); -- { serverError 72 }
|
||||
SELECT toDecimal64('e', 2); -- { serverError 72 }
|
||||
SELECT toDecimal128('e', 3); -- { serverError 72 }
|
||||
|
||||
SELECT toDecimal32OrNull('e', 1) x, isNull(x);
|
||||
SELECT toDecimal64OrNull('e', 2) x, isNull(x);
|
||||
SELECT toDecimal128OrNull('e', 3) x, isNull(x);
|
Loading…
Reference in New Issue
Block a user