Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QgsSQLStatement parser: emit more relevant error message (fixes #42985)
  • Loading branch information
rouault authored and nyalldawson committed May 23, 2021
1 parent d6d1b45 commit 9f1c77b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/qgssqlstatementparser.yy
Expand Up @@ -625,7 +625,15 @@ QgsSQLStatement::Node* parse(const QString& str, QString& parserErrorMsg, bool a
}
else // error?
{
parserErrorMsg = !allowFragments && !ctx.rootNode ? QStringLiteral("Expression must begin with SELECT") : ctx.errorMsg;
if( !allowFragments && !ctx.rootNode &&
!str.startsWith("SELECT", Qt::CaseInsensitive) )
{
parserErrorMsg = QObject::tr("Expression must begin with SELECT");
}
else
{
parserErrorMsg = ctx.errorMsg;
}
delete ctx.rootNode;
delete ctx.whereExp;
qDeleteAll(ctx.joinList);
Expand Down

0 comments on commit 9f1c77b

Please sign in to comment.