diff --git a/cql3/Cql.g b/cql3/Cql.g index 0f2cea0f2d..d1f36cb022 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -1499,8 +1499,7 @@ marker returns [expression value] ; intValue returns [expression value] - : - | t=INTEGER { $value = untyped_constant{untyped_constant::integer, $t.text}; } + : t=INTEGER { $value = untyped_constant{untyped_constant::integer, $t.text}; } | e=marker { $value = std::move(e); } ; diff --git a/test/cql-pytest/test_bad_grammar.py b/test/cql-pytest/test_bad_grammar.py index c7c8023586..6848f64fae 100644 --- a/test/cql-pytest/test_bad_grammar.py +++ b/test/cql-pytest/test_bad_grammar.py @@ -21,3 +21,10 @@ def table1(cql, test_keyspace): def test_json_empty(cql, table1): with pytest.raises(SyntaxException): cql.execute(f'INSERT INTO {table1} JSON') + +# LIMIT should be followed by an expression (#14705) +def test_limit_empty(cql, table1): + with pytest.raises(SyntaxException): + cql.execute(f'SELECT * FROM {table1} LIMIT') + with pytest.raises(SyntaxException): + cql.execute(f'SELECT * FROM {table1} PER PARTITION LIMIT')