Projected column is missing when paging

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Zerda
Posts: 13
Joined: Wed 22 Jan 2014 00:16

Projected column is missing when paging

Post by Zerda » Fri 17 Aug 2018 04:49

Prerequisites:
- dotConnect for Oracle 9.6.570
- EntityFramework Core 2.1.1
- .Net Core 2.1.1

Code: Select all

class Program
{
    static void Main(string[] args)
    {
        var config = OracleEntityProviderConfig.Instance;
        config.Workarounds.DisableQuoting = true;

        var context = new MyDbContext();

        var result = (from o in context.MasterOrders
                      join p in context.Products on o.ProductId equals p.Id into products
                      from p in products.DefaultIfEmpty()
                      select new { o.Id, o.Code, p.Name, p.Length }).OrderBy(o => o.Id).Take(10).ToList();
    }
}

class MyDbContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseOracle(@"REDACTED");
    }

    public DbSet<Product> Products { get; set; }

    public DbSet<MasterOrder> MasterOrders { get; set; }
}

class Product
{
    [Key]
    public int Id { get; set; }

    public string Name { get; set; }

    public int Length { get; set; }
}

class MasterOrder
{
    [Key]
    public int Id { get; set; }

    public string Code { get; set; }

    public int ProductId { get; set; }
}
It create a select sql, but the p.Length projection is missing.

Code: Select all

SELECT t.Id, t.Code, t.Name
FROM (
    SELECT o.Id, o.Code, p.Name, p.Length
    FROM MasterOrders o
    LEFT JOIN Products p ON o.ProductId = p.Id
    ORDER BY o.Id
) t
WHERE ROWNUM <= :p__p_0

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Projected column is missing when paging

Post by Shalex » Wed 22 Aug 2018 18:41

Thank you for your report. We are processing your request.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Projected column is missing when paging

Post by Shalex » Thu 23 Aug 2018 11:28

The version of your target Oracle Server is 11.x, isn't it? We have reproduced the issue and are investigating it.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Projected column is missing when paging

Post by Shalex » Fri 31 Aug 2018 19:06

The bug with missing projected column in the result SQL query generated by EF Core 2.1 provider is fixed: viewtopic.php?f=1&t=37637.

Post Reply