Bug #79448 Include unionall issue
Description:
Hi,
I am encountering an issue on our database model, sadly I haven't yet been able to replicate the issue on a simple model I could attach.
We use include force an eager loading on some table.
model.Ds.Include(x => x.ACs).Include(x => x.Es).Include(x => x.DSs).ToList()
This generates a wrong SQL, the 2 "FROM ((SELECT" :
SELECT `UnionAll2`.`Id` AS `C1`, (...)
FROM ((SELECT
FROM ((SELECT
CASE WHEN (`Join1`.`DAC_AC_Id` IS NULL) THEN (NULL) ELSE (1) END AS `C1`, (...)
The command tree looks like that:
DbQueryCommandTree
|_Query : Collection{Record['C1'=Edm.Int32, (...)
|_Project
|_Input : 'Sort1'
| |_Sort
| |_Input : 'UnionAll2'
| | |_UnionAll
| | |_UnionAll
| | | |_Project
| | | |_Project
| | |_Project
| |_SortOrder
| |_Asc
| | |_Var(UnionAll2).Id1
| |_Asc
| |_Var(UnionAll2).C1
|_Projection
I believe the 2 UnionAll are source of the issue, the first one not containing 2 Projects
In the SelectGenerator.cs:
public override SqlFragment Visit(DbUnionAllExpression expression)
{
UnionFragment f = new UnionFragment();
Debug.Assert(expression.Left is DbProjectExpression);
Debug.Assert(expression.Right is DbProjectExpression);
(...)
Can Visit(DbUnionAllExpression expression) be patched accordingly ?
Thanks.
How to repeat:
Sadly I haven't yet been able to replicate the issue on a simple model I could attach.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Hi, I am encountering an issue on our database model, sadly I haven't yet been able to replicate the issue on a simple model I could attach. We use include force an eager loading on some table. model.Ds.Include(x => x.ACs).Include(x => x.Es).Include(x => x.DSs).ToList() This generates a wrong SQL, the 2 "FROM ((SELECT" : SELECT `UnionAll2`.`Id` AS `C1`, (...) FROM ((SELECT FROM ((SELECT CASE WHEN (`Join1`.`DAC_AC_Id` IS NULL) THEN (NULL) ELSE (1) END AS `C1`, (...) The command tree looks like that: DbQueryCommandTree |_Query : Collection{Record['C1'=Edm.Int32, (...) |_Project |_Input : 'Sort1' | |_Sort | |_Input : 'UnionAll2' | | |_UnionAll | | |_UnionAll | | | |_Project | | | |_Project | | |_Project | |_SortOrder | |_Asc | | |_Var(UnionAll2).Id1 | |_Asc | |_Var(UnionAll2).C1 |_Projection I believe the 2 UnionAll are source of the issue, the first one not containing 2 Projects In the SelectGenerator.cs: public override SqlFragment Visit(DbUnionAllExpression expression) { UnionFragment f = new UnionFragment(); Debug.Assert(expression.Left is DbProjectExpression); Debug.Assert(expression.Right is DbProjectExpression); (...) Can Visit(DbUnionAllExpression expression) be patched accordingly ? Thanks. How to repeat: Sadly I haven't yet been able to replicate the issue on a simple model I could attach.