Select with coalesce operator on field non unicode string should not append N
See original GitHub issueI’m doing a simple select using the coalesce operator with non unicode string and the generated SQL has the appended N
.
Steps to reproduce
context.Contract.Select(x => x.Description ?? "-").FirstOrDefault()
// Mapping
entity.Property(e => e.Description)
.HasColumnName("DESCRIPTION")
.HasColumnType("VARCHAR2(100)")
.IsUnicode(false);
Got this query
SELECT COALESCE("x"."DESCRIPTION", N'-')
FROM "MYDB"."CONTRACT" "x"
FETCH FIRST 1 ROWS ONLY
Further technical details
EF Core version: 2.2.6 Oracle.EntityFrameworkCore: 2.19.70
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
coalesce converts non-unicode characters to question marks
This is an XY Problem. You believe the problem is COALEASE , however, it's this: "Unfortunately, I cannot change data types on remote...
Read more >Why does searching for LIKE N'% %' match any Unicode ...
Changing the SELECT in the last query to SELECT I, N, RANK() OVER(ORDER BY N) shows that SQL Server can't rank the characters....
Read more >COALESCE doesn''t LIKE CHAR
When you use Unicode data (nchar or nvarchar data types) with LIKE, trailing blanks are significant; however, for non-Unicode data, trailing ...
Read more >Functions, operators, and conditionals | BigQuery
Operators are represented by special characters or keywords; they do not use ... If all non- NULL field values are equal, the comparison...
Read more >Documentation: 15: 9.4. String Functions and Operators
The string concatenation operator ( || ) will accept non-string input, ... Checks whether the string is in the specified Unicode normalization form....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With your test case, I see the SQL with the N character generated for the second COALESCE expression now. I’ve filed the bug 31388650 to track this issue. We’ll have a developer review the bug and fix it.
@alexkeh, you’re right. It’s working when putting the
.IsUnicode(False)
. It works with 2.2.6 but not with 2.1.14 (lts). I was mixing the versions in my tests. Thank you for your time