mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Merge pull request #58703 from ClickHouse/imp-error-message
Add identifier name to the error INVALID_IDENTIFIER
This commit is contained in:
commit
62660e6e84
@ -121,6 +121,7 @@ namespace ErrorCodes
|
||||
extern const int FUNCTION_CANNOT_HAVE_PARAMETERS;
|
||||
extern const int SYNTAX_ERROR;
|
||||
extern const int UNEXPECTED_EXPRESSION;
|
||||
extern const int INVALID_IDENTIFIER;
|
||||
}
|
||||
|
||||
/** Query analyzer implementation overview. Please check documentation in QueryAnalysisPass.h first.
|
||||
@ -2423,7 +2424,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveTableIdentifierFromDatabaseCatalog(con
|
||||
{
|
||||
size_t parts_size = table_identifier.getPartsSize();
|
||||
if (parts_size < 1 || parts_size > 2)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER,
|
||||
"Expected table identifier to contain 1 or 2 parts. Actual '{}'",
|
||||
table_identifier.getFullName());
|
||||
|
||||
@ -2820,7 +2821,7 @@ bool QueryAnalyzer::tryBindIdentifierToTableExpression(const IdentifierLookup &
|
||||
{
|
||||
size_t parts_size = identifier_lookup.identifier.getPartsSize();
|
||||
if (parts_size != 1 && parts_size != 2)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER,
|
||||
"Expected identifier '{}' to contain 1 or 2 parts to be resolved as table expression. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
table_expression_node->formatASTForErrorMessage());
|
||||
@ -3048,7 +3049,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromTableExpression(const Id
|
||||
{
|
||||
size_t parts_size = identifier_lookup.identifier.getPartsSize();
|
||||
if (parts_size != 1 && parts_size != 2)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER,
|
||||
"Expected identifier '{}' to contain 1 or 2 parts to be resolved as table expression. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
table_expression_node->formatASTForErrorMessage());
|
||||
@ -4768,7 +4769,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
{
|
||||
size_t parts_size = identifier.getPartsSize();
|
||||
if (parts_size < 1 || parts_size > 2)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER,
|
||||
"Expected {} function first argument identifier to contain 1 or 2 parts. Actual '{}'. In scope {}",
|
||||
function_name,
|
||||
identifier.getFullName(),
|
||||
|
@ -38,7 +38,7 @@ DatabaseAndTableWithAlias::DatabaseAndTableWithAlias(const ASTIdentifier & ident
|
||||
else if (identifier.name_parts.size() == 1)
|
||||
table = identifier.name_parts[0];
|
||||
else
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER, "Invalid identifier");
|
||||
throw Exception(ErrorCodes::INVALID_IDENTIFIER, "Invalid identifier {}", backQuote(identifier.name()));
|
||||
|
||||
if (database.empty())
|
||||
database = current_database;
|
||||
|
@ -1,9 +1,9 @@
|
||||
SET allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT dictGet(t.nest.a, concat(currentDatabase(), '.dict.dict'), 's', number) FROM numbers(5); -- { serverError 36 }
|
||||
SELECT dictGet(t.nest.a, concat(currentDatabase(), '.dict.dict'), 's', number) FROM numbers(5); -- { serverError INVALID_IDENTIFIER }
|
||||
|
||||
SELECT dictGetFloat64(t.b.s, 'database_for_dict.dict1', dictGetFloat64('Ta\0', toUInt64('databas\0_for_dict.dict1databas\0_for_dict.dict1', dictGetFloat64('', '', toUInt64(1048577), toDate(NULL)), NULL), toDate(dictGetFloat64(257, 'database_for_dict.dict1database_for_dict.dict1', '', toUInt64(NULL), 2, toDate(NULL)), '2019-05-2\0')), NULL, toUInt64(dictGetFloat64('', '', toUInt64(-9223372036854775808), toDate(NULL)), NULL)); -- { serverError 36 }
|
||||
SELECT dictGetFloat64(t.b.s, 'database_for_dict.dict1', dictGetFloat64('Ta\0', toUInt64('databas\0_for_dict.dict1databas\0_for_dict.dict1', dictGetFloat64('', '', toUInt64(1048577), toDate(NULL)), NULL), toDate(dictGetFloat64(257, 'database_for_dict.dict1database_for_dict.dict1', '', toUInt64(NULL), 2, toDate(NULL)), '2019-05-2\0')), NULL, toUInt64(dictGetFloat64('', '', toUInt64(-9223372036854775808), toDate(NULL)), NULL)); -- { serverError INVALID_IDENTIFIER }
|
||||
|
||||
SELECT NULL AND (2147483648 AND NULL) AND -2147483647, toUUID(((1048576 AND NULL) AND (2147483647 AND 257 AND NULL AND -2147483649) AND NULL) IN (test_01103.t1_distr.id), '00000000-e1fe-11e\0-bb8f\0853d60c00749'), stringToH3('89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff'); -- { serverError 36 }
|
||||
SELECT NULL AND (2147483648 AND NULL) AND -2147483647, toUUID(((1048576 AND NULL) AND (2147483647 AND 257 AND NULL AND -2147483649) AND NULL) IN (test_01103.t1_distr.id), '00000000-e1fe-11e\0-bb8f\0853d60c00749'), stringToH3('89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff89184926cc3ffff'); -- { serverError INVALID_IDENTIFIER }
|
||||
|
||||
SELECT 'still alive';
|
||||
|
1
tests/queries/0_stateless/02963_invalid_identifier.sql
Normal file
1
tests/queries/0_stateless/02963_invalid_identifier.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT t.t.t.* FROM system.tables WHERE database = currentDatabase(); --{serverError INVALID_IDENTIFIER}
|
Loading…
Reference in New Issue
Block a user