-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Firebird DBMS (v3) has some limitation for arguments of "OFFSET" and "FETCH" in "SELECT" statement - it does not support expressions like "CAST(@param AS INTEGER)"
But it (Firebird) has alternative syntax:
SELECT
[FIRST m] [SKIP n]
[DISTINCT | ALL] ...
without these limitations.
I not see in current EFCore an any legal way for generation of SQL with FIRST and SKIP:
efcore/src/EFCore.Relational/Query/QuerySqlGenerator.cs
Lines 174 to 181 in a0bb25f
| _relationalCommandBuilder.Append("SELECT "); | |
| if (selectExpression.IsDistinct) | |
| { | |
| _relationalCommandBuilder.Append("DISTINCT "); | |
| } | |
| GenerateTop(selectExpression); |
Could you move line with
_relationalCommandBuilder.Append("SELECT "); into separated new virtual function GenerateSelect?
I will override this function and append the generation of FIRST, SKIP.
Firebird DBMS supports an additional variant for this task - ROWS. Native Firebird provider for EFCore uses this statement in their code.
But usage of "ROWS" requires additional "+1" and uses long.MaxValue for describing unlimited number, so it looks less preferred than "FIRST/SKIP".
Of course, I may copy the body of QuerySqlGenerator.VisitSelect into my code (this is my current variant) and resolve this problem, but may be new method "GenerateSelect" will be usefully into another tasks.
Thanks.