question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

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:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alexkehcommented, May 22, 2020

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.

0reactions
rafaelpadovezicommented, Jun 10, 2020

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found