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/ParserPartition.h>
|
||||||
#include <Parsers/ParserSetQuery.h>
|
#include <Parsers/ParserSetQuery.h>
|
||||||
#include <Parsers/parseDatabaseAndTableName.h>
|
#include <Parsers/parseDatabaseAndTableName.h>
|
||||||
|
#include <Common/Exception.h>
|
||||||
#include <Common/assert_cast.h>
|
#include <Common/assert_cast.h>
|
||||||
#include <boost/range/algorithm_ext/erase.hpp>
|
#include <boost/range/algorithm_ext/erase.hpp>
|
||||||
|
|
||||||
@ -16,6 +17,11 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace ErrorCodes
|
||||||
|
{
|
||||||
|
extern const int SYNTAX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using Kind = ASTBackupQuery::Kind;
|
using Kind = ASTBackupQuery::Kind;
|
||||||
@ -78,19 +84,20 @@ namespace
|
|||||||
auto parse_list_element = [&]
|
auto parse_list_element = [&]
|
||||||
{
|
{
|
||||||
DatabaseAndTableName table_name;
|
DatabaseAndTableName table_name;
|
||||||
if (database_name)
|
|
||||||
{
|
if (!parseDatabaseAndTableName(pos, expected, table_name.first, table_name.second))
|
||||||
ASTPtr ast;
|
return false;
|
||||||
if (!ParserIdentifier{}.parse(pos, ast, expected))
|
|
||||||
return false;
|
if (database_name && table_name.first.empty())
|
||||||
table_name.first = *database_name;
|
table_name.first = *database_name;
|
||||||
table_name.second = getIdentifierName(ast);
|
|
||||||
}
|
if (database_name && table_name.first != *database_name)
|
||||||
else
|
throw Exception(
|
||||||
{
|
ErrorCodes::SYNTAX_ERROR,
|
||||||
if (!parseDatabaseAndTableName(pos, expected, table_name.first, table_name.second))
|
"Database name in EXCEPT TABLES clause doesn't match the database name in DATABASE clause: {} != {}",
|
||||||
return false;
|
table_name.first,
|
||||||
}
|
*database_name
|
||||||
|
);
|
||||||
|
|
||||||
result.emplace(std::move(table_name));
|
result.emplace(std::move(table_name));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user