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.
ListContextbuilds the clauses (buildFilter) and the positional params (buildParams) in two separaterangeloops 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
buildParamserror on L258 is #203 item 4. Fix both together.Found while reviewing #251 / #247.