improve error message while using OFFSET FETCH clause without ORDER BY

This commit is contained in:
cms 2021-11-03 13:50:08 +08:00 committed by cmsxbc
parent e3650b865a
commit bc6616d8be
No known key found for this signature in database
GPG Key ID: A58268D081411C9C
2 changed files with 3 additions and 1 deletions

View File

@ -595,6 +595,7 @@
M(625, IO_SETUP_ERROR) \
M(626, CANNOT_SKIP_UNKNOWN_FIELD) \
M(627, BACKUP_ENGINE_NOT_FOUND) \
M(628, OFFSET_FETCH_WITHOUT_ORDER_BY) \
\
M(999, KEEPER_EXCEPTION) \
M(1000, POCO_EXCEPTION) \

View File

@ -23,6 +23,7 @@ namespace ErrorCodes
extern const int SYNTAX_ERROR;
extern const int TOP_AND_LIMIT_TOGETHER;
extern const int WITH_TIES_WITHOUT_ORDER_BY;
extern const int OFFSET_FETCH_WITHOUT_ORDER_BY;
}
@ -323,7 +324,7 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
/// OFFSET FETCH clause must exists with "ORDER BY"
if (!order_expression_list)
return false;
throw Exception("Can not use OFFSET FETCH clause without ORDER BY", ErrorCodes::OFFSET_FETCH_WITHOUT_ORDER_BY);
if (s_first.ignore(pos, expected))
{