Where expression with .All (and this one also 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 also containing .All) generates invalid query

Post by jmeyns » Mon 26 Aug 2019 08:01

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

Code: Select all

// This doesn't - throws ORA-00936: missing expression
                    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
		 (
			NOT (
				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.7.805

A repository reproducing the issue can be found here: https://github.com/janmeyns/devart-efco ... ug-repro-2

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

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

Post by Shalex » Thu 29 Aug 2019 08:27

Thank you for your report. We have reproduced the bug 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 also containing .All) generates invalid query

Post by Shalex » Sat 14 Sep 2019 11:18

The bug with translating .All clause within .Where condition in EF Core 2 is fixed: viewtopic.php?f=1&t=39337.

Post Reply