cql3: grammar: reject intValue with no contents

The grammar mistakenly allows nothing to be parsed as an
intValue (itself accepted in LIMIT and similar clauses).

Easily fixed by removing the empty alternative. A unit test is
added.

Fixes #14705.

Closes #14707

(cherry picked from commit e00811caac)
This commit is contained in:
Avi Kivity
2023-07-20 19:01:05 +03:00
parent 2c50655835
commit 18014f1d9a
2 changed files with 8 additions and 2 deletions

View File

@@ -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')