Skip to content

Declared-nullability check: each emitted SQL function's declaration against PostgreSQL and the complete translated expression (#360's static half) #380

Closed

Description

@CaffeinatedCoder

Problem

#349 (lower/upper) and #360 (array_cat) were declarations that told EF Core a function is NULL exactly when an argument is, where PostgreSQL said otherwise. #362 describes the static half that catches that class: list what the translators emit and check each declaration. Checking pg_proc.proisstrict alone is not enough, because what EF Core reasons about is the whole translated expression: UpperBound() on a discrete range is upper(x) - 1, the factories are a CASE around a non-strict constructor, and a predicate is wrapped in x IS NOT NULL AND ….

Change

A test, DeclaredNullabilityTests (integration project), that translates every discovered range, RangeSet and value set member over a nullable column and a required one, walks the SQL tree EF Core hands the provider, and for each SqlFunctionExpression it finds compares the declared IsNullable and ArgumentsPropagateNullability with pg_proc.proisstrict for that function and argument types. It then evaluates the complete translated expression on the server for NULL and non-NULL inputs and checks that it is NULL exactly when EF Core's declaration says it can be. Disagreements go through Candidates.Verdict.

Done when

Registered in test/oracles/oracles.json and shown to catch bound-declared-null-only-for-a-null-argument.patch; #360's array_cat is reported under #360.

Activity

  1. added
    tests
    area/ranges
    area/range-set
    area/value-sets
    package/efcore
    on Oct 24, 2026
  2. added a commit that references this issue on Oct 24, 2026
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/range-setarea/rangesarea/value-setspackage/efcoretests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions