Files
zeekayandGitHub ddada455ee db: a numeric or boolean filter binds as the type it compares (#81)
The Postgres store compared data->>'f', which is text, with the filter's value
as given. A number or a bool cannot be bound to text: the renewal sweep's
payment-org Balance>0 query failed with "unable to encode 0 into text format
for text (OID 25)" on every pass, and where it did bind, "10" ordered before "9".

A number now compares as a number (CASE WHEN jsonb_typeof(...) = 'number' THEN
(...)::numeric END, so a row whose field is not one matches nothing) and a bool
as its text. Strings are unchanged.

Testing: TestPostgresFilterBindsTheValuesType (the SQL and the argument for each
kind) and TestPostgresFilterRunsAgainstARealServer, run against a throwaway
PostgreSQL 16 (COMMERCE_TEST_POSTGRES_DSN): Balance>0, Balance>9 and Balance<=9
answer as numbers, the bool filters match; the old code fails it with wrong rows.
go test ./db ./models/order passes.
Risk: every numeric or bool filter on the Postgres store, 41 call sites; each was
failing or ordering as text before. The SQLite store is untouched.
How to revert: git revert this commit.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 22:46:17 -08:00
..
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00
2026-09-23 21:52:16 -07:00