Skip to content

v1.15.1

Choose a tag to compare

@gmpassos gmpassos released this 12 Aug 10:02
c05f56e
  • Fixed: a condition comparing a field to null passed as a parameter was
    encoded as field = ? bound to null. = NULL is never true in SQL, so the
    query returned no rows instead of the rows whose column is null.

    ConditionSQLEncoder did turn =/IN against null into IS NULL (and
    !=/NOT IN into IS NOT NULL), but only when the null was written
    straight into the statement. A null arriving as a parameter is encoded as a
    placeholder, whose text never equals 'null', so the conversion was skipped.
    Entity queries take the parameter form, which is why it surfaced there:

    // Returned [] with matching rows present; now returns the rows whose
    // `state` is null.
    repository.selectByQuery(' state == ? && active == ? ',
        parameters: {'state': null, 'active': true});

    The encoder is shared, so this affected every SQL adapter — SQLite,
    PostgreSQL and MySQL alike — and any condition compared against a null
    parameter, including compound ones whose other terms matched.

    Rewriting the comparison also leaves the parameter unmentioned by the
    statement, so it is now dropped once the condition is encoded: PostgreSQL
    rejects a statement carrying variables it does not use. A placeholder still
    referenced by another operator (field > ? bound to null) keeps its binding.

    Covered now by the shared adapter test suite, so all three adapters exercise
    it.

  • reflection_factory: ^2.8.1^2.9.0.

    • 2.8.1 pinned dart_style to the formatter bundled with Dart 3.12, so on
      Dart 3.13 the generated *.reflection.g.dart no longer matched this
      package's own dart format, making dart format --set-exit-if-changed and
      test/ensure_build_test.dart mutually exclusive. 2.9.0 tracks the
      formatter the SDK ships.