Skip to content

Parser fails if a column is called "locked" #243

Description

@kingkero

To demonstrate quickly, I just updated an existing test:

 TEST(SelectSchemaTest) {
-  TEST_PARSE_SINGLE_SQL("SELECT grade FROM some_schema.students;", kStmtSelect, SelectStatement, result, stmt);
+  TEST_PARSE_SINGLE_SQL("SELECT grade, locked FROM some_schema.students;", kStmtSelect, SelectStatement, result, stmt);

   ASSERT(stmt->fromTable);
   ASSERT_EQ(std::string(stmt->fromTable->schema), "some_schema");
 }

Results in:

{ running} SelectSchemaTest
{  failed} SelectSchemaTest
           Assertion failed: result.isValid()
           test//select_tests.cpp:158

With backticks I get

[SQL-Lexer-Error] Unknown Character: `

It seems that since MySQL 8.0.1 LOCKED is a reserved keyword, but even with with 8.0.27 I could easily use it without backticks in a query (see fiddle).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions