Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject LIMIT without any value #14705

Closed
cvybhu opened this issue Jul 14, 2023 · 1 comment
Closed

Reject LIMIT without any value #14705

cvybhu opened this issue Jul 14, 2023 · 1 comment
Assignees
Milestone

Comments

@cvybhu
Copy link
Contributor

cvybhu commented Jul 14, 2023

The CQL grammar allows to specify LIMIT or PER PARTITION LIMIT without any value.
Scylla should reject such queries.

On current Scylla the query fails on an internal type check, which is okayish, but on previous versions of Scylla it causes on_internal_error.

cqlsh:ks> CREATE TABLE tab (p int PRIMARY KEY);
cqlsh:ks> SELECT * FROM tab LIMIT 10;

 p
---

(0 rows)
cqlsh:ks> SELECT * FROM tab LIMIT;
InvalidRequest: Error from server: code=2200 [Invalid query] message="AND conjunction produces a boolean value, which doesn't match the type: org.apache.cassandra.db.marshal.Int32Type of [limit]"
cqlsh:ks> SELECT * FROM tab PER PARTITION LIMIT;
InvalidRequest: Error from server: code=2200 [Invalid query] message="AND conjunction produces a boolean value, which doesn't match the type: org.apache.cassandra.db.marshal.Int32Type of [limit]"
cqlsh:ks> 

We should update the grammar so that the parser rejects such queries.

Scylla version (or git commit hash): 5.4.0~dev-0.20230714.033e5348aa82

@avikivity avikivity assigned cvybhu and avikivity and unassigned cvybhu Jul 14, 2023
avikivity added a commit to avikivity/scylladb that referenced this issue Jul 14, 2023
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 scylladb#14705.
avikivity added a commit to avikivity/scylladb that referenced this issue Jul 19, 2023
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 scylladb#14705.
avikivity added a commit to avikivity/scylladb that referenced this issue Jul 20, 2023
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 scylladb#14705.
patjed41 pushed a commit to patjed41/scylladb that referenced this issue Jul 27, 2023
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 scylladb#14705.

Closes scylladb#14707
@DoronArazii DoronArazii added this to the 5.4 milestone Aug 29, 2023
avikivity added a commit that referenced this issue Oct 25, 2023
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 e00811c)
avikivity added a commit that referenced this issue Oct 25, 2023
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 e00811c)
@avikivity
Copy link
Member

Backported to 5.1, 5.2. 5.4 already has it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants