Merge pull request #46043 from ucasfl/view-syntax

Forbid wrong create view syntax
This commit is contained in:
Han Fei 2023-02-10 21:54:57 +01:00 committed by GitHub
commit 2190a2a6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -1299,14 +1299,13 @@ bool ParserCreateViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
return false;
}
if (ParserKeyword{"TO INNER UUID"}.ignore(pos, expected))
if (is_materialized_view && ParserKeyword{"TO INNER UUID"}.ignore(pos, expected))
{
ParserStringLiteral literal_p;
if (!literal_p.parse(pos, to_inner_uuid, expected))
return false;
}
else if (ParserKeyword{"TO"}.ignore(pos, expected))
else if (is_materialized_view && ParserKeyword{"TO"}.ignore(pos, expected))
{
// TO [db.]table
if (!table_name_p.parse(pos, to_table, expected))

View File

@ -0,0 +1 @@
CREATE VIEW X TO Y AS SELECT 1; -- { clientError 62 }