Merge pull request #1390 from proller/fix6

Fix: An Error SQL will make server down (#1388)
This commit is contained in:
alexey-milovidov 2017-10-23 18:10:42 +03:00 committed by GitHub
commit 6555d08782
3 changed files with 11 additions and 1 deletions

View File

@ -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]);

View File

@ -0,0 +1 @@
Still alive

View File

@ -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';"