mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
Allow parsing both variants of BACKUP EXCEPT TABLES query
This commit is contained in:
parent
66b874dafd
commit
81f6e993e9
@ -9,6 +9,7 @@
|
||||
#include <Parsers/ParserPartition.h>
|
||||
#include <Parsers/ParserSetQuery.h>
|
||||
#include <Parsers/parseDatabaseAndTableName.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include <boost/range/algorithm_ext/erase.hpp>
|
||||
|
||||
@ -16,6 +17,11 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
using Kind = ASTBackupQuery::Kind;
|
||||
@ -78,19 +84,20 @@ namespace
|
||||
auto parse_list_element = [&]
|
||||
{
|
||||
DatabaseAndTableName table_name;
|
||||
if (database_name)
|
||||
{
|
||||
ASTPtr ast;
|
||||
if (!ParserIdentifier{}.parse(pos, ast, expected))
|
||||
return false;
|
||||
|
||||
if (!parseDatabaseAndTableName(pos, expected, table_name.first, table_name.second))
|
||||
return false;
|
||||
|
||||
if (database_name && table_name.first.empty())
|
||||
table_name.first = *database_name;
|
||||
table_name.second = getIdentifierName(ast);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parseDatabaseAndTableName(pos, expected, table_name.first, table_name.second))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (database_name && table_name.first != *database_name)
|
||||
throw Exception(
|
||||
ErrorCodes::SYNTAX_ERROR,
|
||||
"Database name in EXCEPT TABLES clause doesn't match the database name in DATABASE clause: {} != {}",
|
||||
table_name.first,
|
||||
*database_name
|
||||
);
|
||||
|
||||
result.emplace(std::move(table_name));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user