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

[Tables] deleteOne deletes multiple rows if passing inequality on clustering column #1757

Closed
hemidactylus opened this issue Nov 25, 2024 · 2 comments
Labels
Bug Something isn't working Feature - Tables Issue impacts the users of Tables To-Do

Comments

@hemidactylus
Copy link
Contributor

Table:

CREATE TABLE default_keyspace.x (
    a int,
    b int,
    PRIMARY KEY (a, b)
) WITH CLUSTERING ORDER BY (b ASC)

Before deleteOne:

$> select * from x;

 a  | b
----+---
 10 | 1
 10 | 2
 10 | 3
 10 | 4

(4 rows)

deleteOne:

{
    "deleteOne": {
        "filter": {
            "a": 10,
            "b": {"$gt": 1}
        }
    }
}

After deleteOne:

$> select * from x;

 a  | b
----+---
 10 | 1

(1 rows)

Suggestion: restrict the filters to prevent any kind of condition that is not an equality on the whole primary key.

@amorton
Copy link
Contributor

amorton commented Dec 11, 2024

similar to #1758
as in there, i think we should retest after #1729

@amorton amorton added Bug Something isn't working Feature - Tables Issue impacts the users of Tables To-Do labels Dec 11, 2024
@amorton amorton changed the title [Tables] deleteOne zaps multiple rows if passing inequality on clustering column [Tables] deleteOne deletes multiple rows if passing inequality on clustering column Dec 11, 2024
@Yuqi-Du
Copy link
Contributor

Yuqi-Du commented Dec 12, 2024

This one has been fixed,
now in order to avoid impacting multiple rows for deleteOne and updateOne commands, we set the $eq as a restriction in filter.

{
    "errors": [
        {
            "message": "The Filtering using the non `$eq` filter operations can select more than one row, and so cannot be used with the `updateOne` and `deleteOne` commands as they can only modify one row.\n\nThe command used an invalid filter on the columns: b.\n\nResend the command only using `$eq` filters.",
            "scope": "FILTER",
            "errorCode": "UNSUPPORTED_FILTER_FOR_UPDATE_ONE_DELETE_ONE",
            "id": "583dd66e-be6b-496a-8de3-c4194344c7c8",
            "family": "REQUEST",
            "title": "updateOne and deleteOne commands only support filtering using $eq"
        }
    ]
}

@Yuqi-Du Yuqi-Du closed this as completed Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feature - Tables Issue impacts the users of Tables To-Do
Projects
None yet
Development

No branches or pull requests

3 participants