-
Notifications
You must be signed in to change notification settings - Fork 26
Unwanted UNICODE string prefix breaks LIKE operator with a CHAR field in 8-bit codepage #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @ondrejtucny, Since dotnet strings are natively in unicode we chose n-prefixed types to have no problems with storing data of any language out of the box. When DO creates tables structure it uses By the way the problem is not in N'_s', because MS SQL Server is able to implicitly cast between
The caviar here is that So, the options are
just don't forget to register |
Thanks for the workaround! |
I have a pair of legacy tables
d_limit
andc_limit_type
with a N:1 relationship. The legacy SQL code uses a[code] LIKE '_s'
condition, which I cannot reasonably avoid right now.The following legacy select works as intended, finding a
d_limit
row which is linked to ac_limit_type
having thecode
column of the provided pattern:However, when I use the following query:
the query returns nothing. The problem is the generated SQL:
Here, the
LIKE
operator has the operandN'_s'
, and the UNICODEN
specifier silently breaks the query. Apparently, it's not compatible with the data type of[code]
which isCHAR(8)
. The database uses the SQL_Czech_CP1250_CI_AS collation, and hence an 8-bit code page.I think it is an error to generate
N'...'
strings when querying a database with an 8-bit code page, and, specifically, when the other argument of an operator is aCHAR
(or alike) and not anNVAR
(or like).In addition, please note DO here generates an unwanted cast as well:
CAST([a].[id_arch] AS integer) = 0
— this cast is completely useless and I believe it is triggered by the fact thatid_arch
is asmallint
here, and the constant is anint
in C#. I think this is essentially the same issue as #189, which I reported earlier.I am using release 7.1.0-Beta-2.
The text was updated successfully, but these errors were encountered: