Skip to content

issue: storage/dynamodb: List can bind filter values to the wrong columns #253

Description

@Lutherwaves

ListContext builds the clauses (buildFilter) and the positional params (buildParams) in two separate range loops over the same map. Go randomizes map order on each loop, so with 2+ keys the ? placeholders can bind to the wrong columns: status=? AND owner=? gets ["alice", "open"]. No error, just wrong results.

Repro: calling both functions on a 4-key map gave mismatched ordering in 130 of 200 runs.

Fix: build clauses and params in one loop, over slices.Sorted(maps.Keys(filter)).

The swallowed buildParams error on L258 is #203 item 4. Fix both together.

Found while reviewing #251 / #247.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:storageStorage adapters (SQL/Dynamo/Cosmos/Memory)bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions