diff --git a/src/Functions/randomFixedString.cpp b/src/Functions/randomFixedString.cpp index cd19dee0bbc..70c6b013dce 100644 --- a/src/Functions/randomFixedString.cpp +++ b/src/Functions/randomFixedString.cpp @@ -39,7 +39,7 @@ public: if (!isUnsignedInteger(arguments[0].type)) throw Exception("First argument for function " + getName() + " must be unsigned integer", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); - if (!arguments[0].column) + if (!arguments[0].column || !isColumnConst(*arguments[0].column)) throw Exception("First argument for function " + getName() + " must be constant", ErrorCodes::ILLEGAL_COLUMN); const size_t n = arguments[0].column->getUInt(0); diff --git a/tests/queries/0_stateless/01277_random_fixed_string.reference b/tests/queries/0_stateless/01277_random_fixed_string.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/tests/queries/0_stateless/01277_random_fixed_string.reference @@ -0,0 +1 @@ +1 diff --git a/tests/queries/0_stateless/01277_random_fixed_string.sql b/tests/queries/0_stateless/01277_random_fixed_string.sql new file mode 100644 index 00000000000..3fb07114065 --- /dev/null +++ b/tests/queries/0_stateless/01277_random_fixed_string.sql @@ -0,0 +1 @@ +SELECT DISTINCT c > 30000 FROM (SELECT arrayJoin(arrayMap(x -> reinterpretAsUInt8(substring(randomFixedString(100), x + 1, 1)), range(100))) AS byte, count() AS c FROM numbers(100000) GROUP BY byte ORDER BY byte);