Closed llRandom closed 2 weeks ago
Confirmed. With the full repro below, EF generates the following SQL:
-- First query: function is schema-qualified
SELECT c."Id", m."Id", m."MatchScore"
FROM company.company AS c
JOIN LATERAL common.matching_score(c."Id", 1, 1, '[]') AS m ON TRUE
ORDER BY c."Id", m."Id"
-- Second query: function isn't schema-qualified
SELECT c0."CompanyId", c0."CompanyTypeId", c."Id", m."Id"
FROM company.company AS c
JOIN LATERAL matching_score(c."Id", 1, 1, '[]') AS m ON TRUE
INNER JOIN company.company_company_type AS c0 ON c."Id" = c0."CompanyId"
ORDER BY c."Id", m."Id"
Confirmed that this was fixed for 9.0.0 as part of #32815 (https://github.com/dotnet/efcore/pull/32815/files#diff-e56f6f490873a5c9d0bae06280f5c3d1d48ffa9b339b62521afaa61ecae6f5e9R137).
File a bug
Function schema name is lost when
AsSplitQuery()
is applied. IfAsSplitQuery()
call is removed query runs fine and returns results. If I keepAsSplitQuery()
call and create database function in public schema it also works fine. But if function is defined in another schema (common
in this example) it doesn't work because produced query doesn't contain schema nameReproducible demo
Models
Context
Query
Include stack traces
Include provider and version information
EF Core version: 8.0.7 Database provider: Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4 Target framework: .Net 8.0 Operating system: Windows 11 (Version 10.0.22631.3880) IDE: Visual Studio 2022 17.9.3