Closed rajmondburgaj closed 2 years ago
There are differences in implementations, i.e. Support lateral derived tables for MariaDB.
@rajmondburgaj Generally, you want to test your queries against MariaDB in this case, since it is still missing a couple of features necessary for full EF Core support (especially the LATERAL JOIN
support).
I many cases, it is possible to build a query without depending on CROSS APPLY/LATERAL JOIN
support, but those are usually a bit more complex.
Once your queries are using SelectMany()
and more complex nested queries, they are likely to need LATERAL JOIN
support.
I remember posting some sample code showing how to do this a couple of months ago (either here or on StackOverflow).
@rajmondburgaj Generally, you want to test your queries against MariaDB in this case, since it is still missing a couple of features necessary for full EF Core support (especially the
LATERAL JOIN
support).I many cases, it is possible to build a query without depending on
CROSS APPLY/LATERAL JOIN
support, but those are usually a bit more complex. Once your queries are usingSelectMany()
and more complex nested queries, they are likely to needLATERAL JOIN
support.I remember posting some sample code showing how to do this a couple of months ago (either here or on StackOverflow).
@lauxjpn thanks for the reply, I will close the ticket for now since MariaDb does not support such feature. Will try to find your code sample and investigate it if its worth changing my code or just ignore supporting MariaDB for now.
I remember posting some sample code showing how to do this a couple of months ago (either here or on StackOverflow).
I think I was referring to https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1363#issuecomment-913155200, which is not really the same thing.
However, I remember seeing some code emulating a LATERAL JOIN
on StackOverflow (not by me) some time ago.
Might have been CROSS/OUTER APPLY in MySQL.
I am developing an app which was locally using MySql and everything is working fine, no issue when running LINQ queries, but as soon as I deployed to a prod server I realized that there is MariaDb in use instead of MySql, as a result exceptions started popping up across the system, mostly not being able to translate LINQ queries to SQL syntax counterpart. Tried playing around with
ServerVersion
to match MariaDb type and version but still the same. Most of the queries work but some complex ones do not work. As an example this statement does not work:In case of MariaDb it generates this exception:
But when I use MySql I get the following query:
I am using Asp.Net Core 5 with below packages: