Merge pull request #19343 from ucasFL/sleep

fix sleep with infinite input
This commit is contained in:
alexey-milovidov 2021-01-21 15:04:30 +03:00 committed by GitHub
commit 08dc5ebfa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 }