You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While C#'s concatenation operator automatically coalesces nulls to empty strings, SQL doesn't (on PostgreSQL and SQLite, I'm pretty sure this is standard behavior). This forces users to systematically use the C# null coalescing operator ??.
I'm not sure if there are many other examples of C# operators which implicitly coalesce in this way, but I wonder if this is something that EF Core should fix, with the general goal of making server-side execution as close as possible client-side execution.
Note that fixing this would in principle be a breaking change, as current code is written with the expectation that coalescing doesn't occur.
The text was updated successfully, but these errors were encountered:
npgsql/efcore.pg#515 detailed a PostgreSQL FTS related issue around null coalescing which led me to think about the problem in general.
The following code demonstrates a discrepancy between how C# and SQL handle nulls when concatenating strings:
While C#'s concatenation operator automatically coalesces nulls to empty strings, SQL doesn't (on PostgreSQL and SQLite, I'm pretty sure this is standard behavior). This forces users to systematically use the C# null coalescing operator
??
.I'm not sure if there are many other examples of C# operators which implicitly coalesce in this way, but I wonder if this is something that EF Core should fix, with the general goal of making server-side execution as close as possible client-side execution.
Note that fixing this would in principle be a breaking change, as current code is written with the expectation that coalescing doesn't occur.
The text was updated successfully, but these errors were encountered: