Skip to content

Range IsInfinity/IsFinite translations are never executed against PostgreSQL; a wrong composition passes every suite #118

Closed

Description

@CaffeinatedCoder

The single-range state predicates IsInfinity() and IsFinite() translate to compositions of lower_inf, upper_inf and isempty (ValueRangesMethodCallTranslator.cs, the IsInfinityMethod / IsFiniteMethod arms), and nothing executes them against PostgreSQL. The only guard is QueryTranslationTests.Range_IsInfinity_ComposesBothUnboundedChecks, which asserts substrings: lower_inf(b."Period"), upper_inf(b."Period") and "AND".

Seeded on a scratch clone of main (7f4dc47): IsInfinity → lower_inf(x) AND NOT upper_inf(x). Every suite stayed green —

Suite Result with the seed
CodoMetis.ValueRanges.EFCore.PostgreSQL.Tests 242 passed
CodoMetis.ValueRanges.Conventions.Tests 102 passed
CodoMetis.ValueRanges.EFCore.PostgreSQL.IntegrationTests (live PostgreSQL) 149 passed

— while the seeded SQL answers true for (,5] and false for (,), the opposite of memory. The multirange forms are covered (MultirangeShapePredicates_MatchInMemory executes them per shape); the range forms are not.

Test to add: execute IsEmpty, IsInfinity, IsFinite, IsUnboundedStart and IsUnboundedEnd on a range column for all five shapes and compare each with the in-memory answer, as the multirange test does. Keep the seed as test/oracles/seeds/range-isinfinity-composition.patch naming that test. The QueryTranslationTests substring assertions can then assert the whole expression rather than fragments.

Found in the 10.0.0 bug hunt (code-analyst seeding, reproduced here). Tests only; the shipped translation is right.

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/rangesRange unions, variants and the shape enginespackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLtestsAdds or changes tests only (oracles, harnesses); no library code

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions