mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #16768 from ClickHouse/better-diagnostic-on-create-syntax-error
Better diagnostics on syntax error in CREATE TABLE query
This commit is contained in:
commit
8289fe7b9f
@ -144,8 +144,8 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
||||
/// doesn't check that parsed string is existing data type. In this way
|
||||
/// REMOVE keyword can be parsed as data type and further parsing will fail.
|
||||
/// So we just check this keyword and in case of success return column
|
||||
/// column declaration with name only.
|
||||
if (s_remove.checkWithoutMoving(pos, expected))
|
||||
/// declaration with name only.
|
||||
if (!require_type && s_remove.checkWithoutMoving(pos, expected))
|
||||
{
|
||||
if (!check_keywords_after_name)
|
||||
return false;
|
||||
@ -165,11 +165,12 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
||||
ASTPtr codec_expression;
|
||||
ASTPtr ttl_expression;
|
||||
|
||||
if (!s_default.checkWithoutMoving(pos, expected) &&
|
||||
!s_materialized.checkWithoutMoving(pos, expected) &&
|
||||
!s_alias.checkWithoutMoving(pos, expected) &&
|
||||
!s_comment.checkWithoutMoving(pos, expected) &&
|
||||
!s_codec.checkWithoutMoving(pos, expected))
|
||||
if (!s_default.checkWithoutMoving(pos, expected)
|
||||
&& !s_materialized.checkWithoutMoving(pos, expected)
|
||||
&& !s_alias.checkWithoutMoving(pos, expected)
|
||||
&& (require_type
|
||||
|| (!s_comment.checkWithoutMoving(pos, expected)
|
||||
&& !s_codec.checkWithoutMoving(pos, expected))))
|
||||
{
|
||||
if (!type_parser.parse(pos, type, expected))
|
||||
return false;
|
||||
|
@ -0,0 +1 @@
|
||||
Unknown data type family: CODEC
|
6
tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sh
Executable file
6
tests/queries/0_stateless/01559_misplaced_codec_diagnostics.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
${CLICKHOUSE_CLIENT} --query "CREATE TABLE t (c CODEC(NONE)) ENGINE = Memory" 2>&1 | grep -oF 'Unknown data type family: CODEC' | uniq
|
Loading…
Reference in New Issue
Block a user