fix sleep with infinite input

This commit is contained in:
feng lv 2021-01-21 04:49:35 +00:00
parent af4afff723
commit 2094eae23d
3 changed files with 4 additions and 2 deletions

View File

@ -78,8 +78,8 @@ public:
Float64 seconds = applyVisitor(FieldVisitorConvertToNumber<Float64>(), assert_cast<const ColumnConst &>(*col).getField());
if (seconds < 0)
throw Exception("Cannot sleep negative amount of time (not implemented)", ErrorCodes::BAD_ARGUMENTS);
if (seconds < 0 || !std::isfinite(seconds))
throw Exception("Cannot sleep infinite or negative amount of time (not implemented)", ErrorCodes::BAD_ARGUMENTS);
size_t size = col->size();

View File

@ -0,0 +1,2 @@
SELECT sleep(nan); -- { serverError 36 }
SELECT sleep(inf); -- { serverError 36 }