Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested custom types are not loaded correctly #5671

Open
finomen opened this issue Apr 15, 2024 · 0 comments
Open

Nested custom types are not loaded correctly #5671

finomen opened this issue Apr 15, 2024 · 0 comments

Comments

@finomen
Copy link

finomen commented Apr 15, 2024

Steps to reproduce

Create user defiend type referencing another type, for example
CREATE DOMAIN temperature AS numeric; CREATE TYPE temperature_range AS RANGE (SUBTYPE=library.temperature);

The issue

Type is not loaded and could not be fetched
Log

trce: Npgsql.Connection[0]
Range type 'temperature_range' refers to unknown subtype with OID 25040, skipping

Error

Unhandled exception. System.InvalidCastException: Reading as 'System.Object' is not supported for fields having DataTypeName '.<unknown>'
 ---> System.ArgumentException: A PostgreSQL type with the oid '0' was not found in the current database info
   at Npgsql.Internal.NpgsqlDatabaseInfo.GetPostgresType(UInt32 oid)
   at Npgsql.Internal.NpgsqlDatabaseInfo.GetPostgresType(Oid oid)
   at Npgsql.Internal.NpgsqlDatabaseInfo.GetDataTypeName(PgTypeId pgTypeId, Boolean validate)
   at Npgsql.Internal.TypeInfoCache`1.<GetOrAddInfo>g__CreateInfo|6_3(Type type, Nullable`1 typeId, PgSerializerOptions options, Boolean defaultTypeFallback, Boolean validatePgTypeIds)
   at Npgsql.Internal.TypeInfoCache`1.<GetOrAddInfo>g__AddEntryById|6_2(Type type, TPgTypeId pgTypeId, ValueTuple`2[] infos, Boolean defaultTypeFallback)
   at Npgsql.Internal.TypeInfoCache`1.GetOrAddInfo(Type type, Nullable`1 pgTypeId, Boolean defaultTypeFallback)
   at Npgsql.Internal.PgSerializerOptions.GetTypeInfoCore(Type type, Nullable`1 pgTypeId, Boolean defaultTypeFallback)
   at Npgsql.Internal.PgSerializerOptions.GetObjectOrDefaultTypeInfo(PostgresType pgType)
   at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForReading(Type type, PostgresType postgresType, PgSerializerOptions options)

Further technical details

Npgsql version: 8.0.2
PostgreSQL version: 14
Operating system: Windows 11

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

No branches or pull requests

1 participant