Skip to content

Commit

Permalink
Fix: An Error SQL will make server down (ClickHouse#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 23, 2017
1 parent dd45194 commit d8038cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dbms/src/DataTypes/DataTypeArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Field DataTypeArray::getDefault() const

static DataTypePtr create(const ASTPtr & arguments)
{
if (arguments->children.size() != 1)
if (!arguments || arguments->children.size() != 1)
throw Exception("Array data type family must have exactly one argument - type of elements", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);

DataTypePtr nested_type = DataTypeFactory::instance().get(arguments->children[0]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Still alive
9 changes: 9 additions & 0 deletions dbms/tests/queries/0_stateless/00507_array_no_params.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh

$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.foo;"
# Missing arguments for array, table not created
$CLICKHOUSE_CLIENT -q "CREATE TABLE test.foo (a Array) Engine=Memory;"
$CLICKHOUSE_CLIENT -q "SELECT 'Still alive';"

0 comments on commit d8038cf

Please sign in to comment.