You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PostgreSqlDbHelper.DynamicHandler changes the NpgsqlParameter.NpgsqlDbType to Unknown for all Enum types. That sets the _npgsqlDbType from null to Unknown. _npgsqlDbType is not null as it should and this leads to wrong invocation chain within NpgsqlParameter.ResolveTypeInfo (AdoSerializerHelpers.GetTypeInfoForWriting -> ... -> TypeInfoCache<TPgTypeId>.GetOrAddInfo ...).
I've checked that if I don't set the type to Unknown the code works as expected and correct Oid and type is selected during type resolution.
This change was introduced in fix for #1040, but I'm not sure this is a correct solution and if it is necessary anymore. If it is, I think there should be some check as in RepoDb Compiler.GetPlainTypeToDbParametersCompiledFunction where for enums there is a check if the type IsPostgreSqlUserDefined (maybe the fix should be there?).
Exception Message:
AdoSerializerHelpers.GetTypeInfoForWritingInvalidCastException
Writing values of 'Models.OurType' is not supported for parameters having DataTypeName 'Unknown'
Bug Description
We have a user defined type in the PostgreSQL db.
In c# code we map the enum using
For writing we use the code like this
PostgreSqlDbHelper.DynamicHandler
changes theNpgsqlParameter.NpgsqlDbType
toUnknown
for allEnum
types. That sets the_npgsqlDbType
fromnull
toUnknown
._npgsqlDbType
is notnull
as it should and this leads to wrong invocation chain withinNpgsqlParameter.ResolveTypeInfo
(AdoSerializerHelpers.GetTypeInfoForWriting -> ... -> TypeInfoCache<TPgTypeId>.GetOrAddInfo ...
).I've checked that if I don't set the type to
Unknown
the code works as expected and correctOid
and type is selected during type resolution.This change was introduced in fix for #1040, but I'm not sure this is a correct solution and if it is necessary anymore. If it is, I think there should be some check as in RepoDb
Compiler.GetPlainTypeToDbParametersCompiledFunction
where for enums there is a check if the typeIsPostgreSqlUserDefined
(maybe the fix should be there?).Exception Message:
Library Version:
RepoDb v1.13.1
RepoDb.PostgreSql v1.13.1
Npgsql 8.0.2
The text was updated successfully, but these errors were encountered: