Skip to content

[9.0] Fix reading empty multidimensional arrays - #6676

Merged
roji merged 1 commit into
hotfix/9.0.6from
roji-npgsql-9-empty-arrays
Oct 18, 2026
Merged

roji merged 1 commit into
hotfix/9.0.6from
roji-npgsql-9-empty-arrays

Conversation

@roji

@roji roji commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Backports only the empty-array rank fix from #6472 (fc81e74), without its unrelated array converter cleanup.

PostgreSQL reports zero dimensions for empty arrays. Honor the requested CLR rank when creating the empty collection, so reading '{}'::double precision[] as double[,] no longer throws InvalidCastException.

Fixes #6675.

Validation on PostgreSQL 18.4 and .NET 8:

  • The new regression test fails before the fix for sync/async getters with multiplexing enabled and disabled, then passes after the fix.
  • All ArrayTests: 68 passed, 2 expected multiplexing skips.
  • EF provider 9.0.0: empty and nonempty arrays round-trip with explicit shape/value assertions, both directly as double[,] and through ValueConverter<List<Vertex>, double[,]>. The released driver reproduces the cast failure; the fixed 9.0 driver passes.
  • After rebasing onto the updated hotfix/9.0.6, all 4 focused regression cases passed. The duplicate CodeQL cleanup was dropped because it is now in the release branch.

Preserve the requested CLR array rank when PostgreSQL reports zero dimensions. Backport the functional fix from fc81e74 without the array converter cleanup, with sync and async regression coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 6d345d71-8f28-4c61-a318-d28bbf7c105b
@roji
roji force-pushed the roji-npgsql-9-empty-arrays branch from 373d824 to 067970e Compare October 18, 2026 10:55
@roji
roji merged commit 307f949 into hotfix/9.0.6 Oct 18, 2026
13 checks passed
@roji
roji deleted the roji-npgsql-9-empty-arrays branch October 18, 2026 11:28
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.

Regression in Npgsql 9: reading an empty multidimensional array throws InvalidCastException

1 participant