Efcore: Select with coalesce operator on field non unicode string should not append N

Created on 19 May 2020  路  5Comments  路  Source: dotnet/efcore

I'm doing a simple select using the coalesce operator with non unicode string and the generated SQL has the appended N.

Steps to reproduce

```C#
context.Contract.Select(x => x.Description ?? "-").FirstOfDefault();

entity.Property(e => e.Description)
.HasColumnName("DESCRIPTION")
.HasColumnType("VARCHAR2(100)")
.IsUnicode(false);


Got this query

```sql
SELECT COALESCE("x"."DESCRIPTION", N'-')
FROM "MYDB"."CONTRACT" "x"
FETCH FIRST 1 ROWS ONLY

Further technical details (EDITED)

EF Core version: 2.1.14
Database provider: Microsoft.EntityFrameworkCore.Oracle
Target framework: .NET Core 3.1
Operating system: Windows
IDE: (e.g. Visual Studio 2019 16.5

closed-fixed customer-reported type-bug

All 5 comments

@rafaelpadovezi EF Core 2.2 is out-of-support. Please update to 3.1, or downgrade to 2.1, the currently supported versions.

Thanks for the reply @ajcvickers . After downgrading to 2.1.14 still got the same error. Do you think this is provider specific? I'm using Oracle.

@rafaelpadovezi #13906 indicates that this was a problem for other providers also in 2.1.4. We added regression test for this scenario so it should be fixed now.

Thanks for the reply. Closing the issue now.

@ajcvickers milestone-deprived issue

Was this page helpful?
0 / 5 - 0 ratings