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
{{ message }}
Repository navigation
Full Text Search method "Matches" fails when not using a string query #3041
The below is an AI-generated analysis and may contain inaccuracies.
Confirmed a PostgreSQL-provider bug: the parameter's declared CLR type matters. var tsQuery = new NpgsqlTsQueryLexeme(...) produces a parameter typed as NpgsqlTsQueryLexeme, but the provider only registers a mapping for the base NpgsqlTsQuery type. Consequently, .Matches(tsQuery) fails during query translation, before any connection to PostgreSQL is needed.
The minimal repro below fails with the reported missing-type-mapping exception on provider 7.0.18, 8.0.0, 8.0.11, and 10.0.3. The current main branch also lacks mappings for the derived tsquery types. This is therefore not a regression introduced in 8.0; no earlier working version was identified.
A verified workaround on 8.0.0 and 10.0.3 is to declare the variable as the base type:
This is provider-specific: NpgsqlTsQuery, NpgsqlTsVector, and their full-text operators are PostgreSQL-specific APIs, so switching this repro to another provider would not test the same behavior.
Issue #886 previously identified the missing derived-type mappings as a separate problem alongside an empty-query driver failure. It is related, but the driver roundtrip problem is not needed to reproduce this issue. No matching existing PR or duplicate in the EF Core repository was found. The similarly named dotnet/efcore#27146 concerns text-search configuration, not CLR type mapping.
minimal repro
Reference Npgsql.EntityFrameworkCore.PostgreSQL version 8.0.0 (also reproduced with the other versions above). No database is required because ToQueryString() triggers the failure.
Activity
roji commentedon Oct 20, 2026
AI Triage
The below is an AI-generated analysis and may contain inaccuracies.
Confirmed a PostgreSQL-provider bug: the parameter's declared CLR type matters.
var tsQuery = new NpgsqlTsQueryLexeme(...)produces a parameter typed asNpgsqlTsQueryLexeme, but the provider only registers a mapping for the baseNpgsqlTsQuerytype. Consequently,.Matches(tsQuery)fails during query translation, before any connection to PostgreSQL is needed.The minimal repro below fails with the reported missing-type-mapping exception on provider 7.0.18, 8.0.0, 8.0.11, and 10.0.3. The current main branch also lacks mappings for the derived tsquery types. This is therefore not a regression introduced in 8.0; no earlier working version was identified.
A verified workaround on 8.0.0 and 10.0.3 is to declare the variable as the base type:
This is provider-specific:
NpgsqlTsQuery,NpgsqlTsVector, and their full-text operators are PostgreSQL-specific APIs, so switching this repro to another provider would not test the same behavior.Issue #886 previously identified the missing derived-type mappings as a separate problem alongside an empty-query driver failure. It is related, but the driver roundtrip problem is not needed to reproduce this issue. No matching existing PR or duplicate in the EF Core repository was found. The similarly named dotnet/efcore#27146 concerns text-search configuration, not CLR type mapping.
minimal repro
Reference
Npgsql.EntityFrameworkCore.PostgreSQLversion8.0.0(also reproduced with the other versions above). No database is required becauseToQueryString()triggers the failure.