When having a database with two or more schemas where each schema has the same enum type, Npgsql logs false positive entries like:
Skipping enum type with OID xx which was not found in pg_type
Minimal example reproducing the warning logging:
using Microsoft.Extensions.Logging;
using Npgsql;
const string cns = "Host=*;Database=*;Username=*;Password=*;Search Path=schema_a;";
using var dataSource = new NpgsqlDataSourceBuilder(cns)
.MapEnum<MyEnum>("my_enum")
.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()))
.ConfigureTypeLoading(x => x.SetTypeLoadingSchemas("schema_a"))
.Build();
dataSource.CreateCommand("SELECT VERSION()").ExecuteReader();
public enum MyEnum { Foo, Bar }
targeting a database with the following schema:
CREATE SCHEMA schema_a;
CREATE TYPE schema_a.my_enum AS ENUM ('foo', 'bar');
CREATE SCHEMA schema_b;
CREATE TYPE schema_b.my_enum AS ENUM ('foo', 'bar');
I guess that the GenerateLoadEnumFieldsQuery method in PostgresDatabaseInfo.cs do no filter on schema/namespace when type loading schema is specified in the builder: .ConfigureTypeLoading(x => x.SetTypeLoadingSchemas("schema_a")).