Where expression with .All (and this one containing !.All) generates invalid query

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
jmeyns
Posts: 1
Joined: Mon 26 Aug 2019 07:50

Where expression with .All (and this one containing !.All) generates invalid query

Post by jmeyns » Thu 23 Jan 2020 14:39

In this example the Where expression has been replaced by a FirstOrDefault expression.

Code: Select all

var classroomResult2 = context
                        .Set<Classroom>()
                        .FirstOrDefault(_ => _.PuzzleGroups.All(gr => !gr.Puzzles.All(p => p.Completed)));
Invalid query:

Code: Select all

SELECT
	 "_".ID,
	 "_".NAME

FROM CLASSROOM "_"

WHERE NOT EXISTS (
	
    SELECT
		 1
    
	FROM PUZZLE_GROUP "gr"
    
	WHERE (
		"_".ID = "gr".CLASSROOM_ID)
	 AND
		 (
			SELECT
				 CASE
        WHEN NOT EXISTS (
					
            SELECT
						 1
            
					FROM PUZZLE "p"
            
					WHERE (
						"gr".ID = "p".PUZZLE_GROUP_ID)
					 AND
						 (
							"p".COMPLETED = 0)
						)
					
        THEN 1 ELSE 0
    END
    
				FROM DUAL)
			)
		
FETCH FIRST 1 ROWS ONLY
Database Provider: Devart.Data.Oracle.EFCore version 9.10.909

A repository reproducing the issue can be found here: https://github.com/janmeyns/devart-efco ... ll-not-all

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

Re: Where expression with .All (and this one containing !.All) generates invalid query

Post by Shalex » Tue 28 Jan 2020 13:54

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

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

Re: Where expression with .All (and this one containing !.All) generates invalid query

Post by Shalex » Thu 06 Feb 2020 11:14

The bug with using .All in the .Where expression in EF Core 2 and EF Core 3 is fixed. We will notify you when the new public build of dotConnect for Oracle is available for download.

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

Re: Where expression with .All (and this one containing !.All) generates invalid query

Post by Shalex » Mon 02 Mar 2020 16:22

dotConnect for Oracle v9.11.951 is released: viewtopic.php?f=1&t=39884.

Post Reply