Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Compare integer fields with fractions and large numbers as with integers - Compare integer fields only with integers beyond their range as a bigint
Flo0807
force-pushed
the
feature/adapter-neutral-filters-and-metrics
branch
from
November 13, 2026 09:46
f58d61e to
7d25e7d
Compare
Flo0807
force-pushed
the
fix/cast-condition-values
branch
from
November 13, 2026 09:46
c5ec241 to
3ed3707
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #2340.
A range filter on an integer column crashed the index view for a number beyond the range of the column, e.g.
?filters[likes][start]=3000000000in the demo: Postgrex can't encode3000000000for anintegercolumn, or10^20for any integer column (DBConnection.EncodeError). Users can reach this by typing a number in the filter or by editing the URL.develophas the same crash; #2366 notes it as not covered.The Ecto adapter now turns the comparison of an integer field with such an integer into a comparison it can run, with the same items:
$1::bigint), which Postgres compares with any integer column.likes >= 10^20becomeslikes > 9223372036854775807.As before, these comparisons don't keep items whose field is
nil, also when negated. The fix lives in the adapter, so it applies to every condition of a filter and to the:whereof a metric, not only to the Range filter. Integers within the range of an integer, other fields and other values (fractions, strings) are cast to the type of the field as before. Fractions on integer fields are handled by #2366, which rejects them in the Range filter.Testing
Backpex.Adapters.Ecto.Where), so it also applies to fields of related items, e.g.expr(user.age < 3_000_000_000). The unit tests use expressions and cover a path and a flipped comparison.mix testincl.integration_test/1431 passed (180 doctests),mix test --only e2e60 passed,mix credo,mix format --check-formattedand the 47 demo tests pass.integration_test/index/filters_test.exs. It fails withDBConnection.EncodeErrorwithout this fix.mix testincl.integration_test/1394 passed (171 doctests),mix test --only e2e60 passed,bun run lint:standard,bun run test:js,mix credoand the 47 demo tests pass.MIX_ENV=test mix lint(164 doctests, 655 tests) andmix docs --warnings-as-errorspass. New tests cover the bigint parameter, the bigint bounds for every operator, negation and the values left to the cast.filter_live_test.exspasses (25 tests). The new test filters the likes beyond the range of an integer and a bigint; with the adapter of Let the adapter turn filter conditions and metric aggregates into queries #2340 it fails withDBConnection.EncodeError.