mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
check for trash
This commit is contained in:
parent
8d91419a25
commit
dec0430327
@ -30,7 +30,7 @@ String ReplaceQueryParameterVisitor::getParamValue(const String & name)
|
||||
if (search != parameters_substitution.end())
|
||||
return search->second;
|
||||
else
|
||||
throw Exception("Expected name " + name + " in argument --param_{name}", ErrorCodes::BAD_ARGUMENTS);
|
||||
throw Exception("Expected name '" + name + "' in argument --param_{name}", ErrorCodes::BAD_ARGUMENTS);
|
||||
}
|
||||
|
||||
void ReplaceQueryParameterVisitor::visitQP(ASTPtr & ast)
|
||||
@ -41,6 +41,7 @@ void ReplaceQueryParameterVisitor::visitQP(ASTPtr & ast)
|
||||
|
||||
/// Replacing all occurrences of types Date and DateTime with String.
|
||||
/// String comparison is used in "WHERE" conditions with this types.
|
||||
|
||||
boost::replace_all(type, "DateTime", "String");
|
||||
boost::replace_all(type, "Date", "String");
|
||||
|
||||
@ -51,6 +52,9 @@ void ReplaceQueryParameterVisitor::visitQP(ASTPtr & ast)
|
||||
FormatSettings format_settings;
|
||||
data_type->deserializeAsWholeText(temp_column, read_buffer, format_settings);
|
||||
|
||||
if (!read_buffer.eof())
|
||||
throw Exception("Expected correct value in parameter with name '" + ast_param->name + "'", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
Field field = temp_column[0];
|
||||
ast = std::make_shared<ASTLiteral>(std::move(field));
|
||||
}
|
||||
|
@ -3,3 +3,5 @@
|
||||
[10,10,10]
|
||||
[[10],[10],[10]]
|
||||
[10,10,10] [[10],[10],[10]] (10,'Test') (10,('dt',10)) 2015-02-15
|
||||
Code: 36. DB::Exception: Expected correct value in parameter with name 'injection'
|
||||
|
||||
|
@ -25,9 +25,12 @@ $CLICKHOUSE_CLIENT --max_threads=1 --param_d_a="[[1, 1], [2, 2]]"\
|
||||
-q "SELECT dt FROM ps WHERE da = {d_a:Array(Array(UInt8))}";
|
||||
$CLICKHOUSE_CLIENT --max_threads=1 --param_tisd="(10, 'Test')"\
|
||||
-q "SELECT a FROM ps WHERE t = {tisd:Tuple(Int16, String)}";
|
||||
$CLICKHOUSE_CLIENT --max_threads=1 --param_d_t="(10, ('dt', 10)))"\
|
||||
$CLICKHOUSE_CLIENT --max_threads=1 --param_d_t="(10, ('dt', 10))"\
|
||||
-q "SELECT da FROM ps WHERE dt = {d_t:Tuple(UInt8, Tuple(String, UInt8))}";
|
||||
$CLICKHOUSE_CLIENT --max_threads=1 --param_nd="2015-02-15"\
|
||||
-q "SELECT * FROM ps WHERE n = {nd:Nullable(Date)}";
|
||||
$CLICKHOUSE_CLIENT --max_threads=1 --param_injection="[1] OR 1"\
|
||||
-q "SELECT * FROM ps WHERE a = {injection:Array(UInt32)}" 2>&1\
|
||||
&& grep 'Expected correct value in parameter';
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "DROP TABLE ps";
|
||||
|
Loading…
Reference in New Issue
Block a user