Skip to content

[10.0] Fix byte-array projections from JSON collections - #4073

Merged
roji merged 1 commit into
hotfix/10.0.4from
roji-json-binary-backport-10-0
Oct 22, 2026
Merged

roji merged 1 commit into
hotfix/10.0.4from
roji-json-binary-backport-10-0

Conversation

@roji

@roji roji commented Oct 22, 2026

Copy link
Copy Markdown
Member

Fixes #3566.

Backports the complete merged change from #4067 (c1ac3e1) to hotfix/10.0.4, including the complex-mapping regression and final visitor comments.

Extract affected json_to_recordset/jsonb_to_recordset binary fields as text and rewrite their references to decode(column, 'base64'), preserving the binary type mapping. The production fix is unchanged from main and runs after relational postprocessing, keeping the generated SQL flat without wrapper subqueries.

EF10 has no JsonTranslationsNpgsqlTest, so adapt the regression to its existing AdHocJsonQueryNpgsqlTest suite. Cover complex JSON collections with both json and jsonb, sync/async execution, exact bytes [0, 1, 127, 128, 255], empty arrays, null values, full-document materialization, collection projection, server-side equality, and exact SQL assertions. No dependency changes.

Validation against a dedicated PostgreSQL 18 container:

  • All four regression cases reproduced the incorrect base64-text bytes before the fix and pass afterward.
  • Focused ad-hoc/shared JSON collection and projection suites: 656 passed, 8 skipped, 0 failed.

Related upstream reference: dotnet/efcore#33440, the sibling SQL Server scalar fix rather than shared EF code replacing this PostgreSQL patch.

Backport the complete merged change from #4067 (c1ac3e1), adapting its complex JSON regression to the EF10 ad-hoc JSON suite.

Fixes #3566

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 187745a9-eff9-41fb-8678-a531666c27f6
@roji
roji merged commit dbf9600 into hotfix/10.0.4 Oct 22, 2026
9 checks passed
@roji
roji deleted the roji-json-binary-backport-10-0 branch October 22, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Byte array in owned entity mapped to JSON returns different value when using projection

1 participant