Skip to content

Conversation

@vonzshik
Copy link
Contributor

@vonzshik vonzshik commented Oct 8, 2025

Fixes #6240

So, there are two issues that are fixed.

The first one started to reproduce after #5123 and the gist of it is that while before we were consulting type mapping to deduce which actual type we're retrieving for schema, afterwards we stopped doing that. The fix seems to be quite easy, an additional GetRepresentationalType call will unwrap all possible domains so we'll retrieve the original type.

As for the second, this one is a bit weird. After #5559 NpgsqlDataReader.GetColumnSchema started to return the actual types for arrays (say, int[] or something similar) while NpgsqlDataReader.GetFieldType is still returning Array (no idea why is that) and this mismatch resulted in NpgsqlDataAdapter being a bit confused because it can't map Array to int[] (and that is because typeof(Array).IsArray returns false, funny enough). As a fix I changed the way we retrieve the type by passing typeof(object) (similar to how is done for GetFieldType).

@NinoFloris you probably should also take a look.

@vonzshik vonzshik requested a review from roji as a code owner October 8, 2025 15:13
@vonzshik vonzshik merged commit 6d2f348 into main Oct 15, 2025
16 checks passed
@vonzshik vonzshik deleted the 6240-adapter-domains-and-arrays-fixes branch October 15, 2025 13:30
vonzshik added a commit that referenced this pull request Oct 15, 2025
vonzshik added a commit that referenced this pull request Oct 15, 2025
@vonzshik
Copy link
Contributor Author

Backported to 9.0.5 via 5dfd2e4, 8.0.9 via b732322

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.

NpgsqlDataAdapter problems in current version with domain and array types

3 participants