Skip to content

PartiQL DELETE/UPDATE apply to rows a non-key WHERE predicate should exclude #54

@hicksy

Description

@hicksy

Surfaced while reviewing #40, but it predates that change (traces back to v0.9.5). A PartiQL DELETE or UPDATE extracts the key from the WHERE clause but does not evaluate the remaining non-key predicates before acting.

Repro: DELETE FROM "t" WHERE pk = 'a' AND NOT begins_with(name, 'x') deletes the row keyed pk='a' even when name begins with x, i.e. when the filter should have excluded it. The same applies to UPDATE ... WHERE.

This is a data-correctness bug: a statement that should be a no-op (or should touch fewer rows) mutates data. The executor's DELETE/UPDATE paths use the key-equality extractor and skip the matches_where pass that SELECT runs.

Fix: evaluate the full condition set against each candidate row before deleting or updating it, as the SELECT path already does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    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