Page 1 of 1

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

Posted: Mon 26 Aug 2019 08:01
by jmeyns
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

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

Posted: Thu 29 Aug 2019 08:27
by Shalex
Thank you for your report. We have reproduced the bug and will notify you when it is fixed.

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

Posted: Sat 14 Sep 2019 11:18
by Shalex
The bug with translating .All clause within .Where condition in EF Core 2 is fixed: viewtopic.php?f=1&t=39337.