-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
SQL SELECT not suport Unicode #13440
Comments
This is weird, I will look to this |
"N" prefix on string literals is a SQL Server thing. Not sure if any other db engine is using it. Have you tried to perform query without N prefix? I can search for string with unicode characters with no problems: |
@lampersky I remembered |
@hishamco |
Anyhow many things will be easier to adapt if we use Parlot :) |
@hishamco |
I'm sure it won't work with Arabic letter unless you supplied |
@sebastienros can we modify the |
I need to understand when SQL Server requires the |
From what I am reading, a solution might be to inject |
This is required one you are using
I don't think that's enough coz the parser will assume the string literal starts with a single quote, which is wrong in this case. May be adapt the |
My suggestion is to change the SQL generated for SQL SERVER -> The SQL SERVER DIALECT. So SQL SERVER will have to use unicode for all string literals it parses. |
Got it but how the |
Example, these are "SQL SERVER" queries before: There is no change in the grammar or the input SQL, this is "GENERATED SQL SERVER" SQL |
Note that I am not sure it will work, but this is my suggestion for now. |
It's fine at YeSQL sebastienros/yessql#482 but the problem should occur here
|
The parser will parse |
That means the |
Also note that if queried column is nvarchar, passing varchar parameter (or the other way around) will cause a conversion operator call for each equality check. |
@lahma isn't that an orthogonal issue that would already apply today if we are not matching the types (haven't checked)? I believe that what I am suggesting is only to let SQL SERVER parse a query expecting unicode chars in the string literal. |
It's generally a problem yes if not accounted for. I've tripped on this one with Quartz years ago which caused indexes/primary keys become less efficient as each comparison required conversion function. This was just a general note. |
YesSQL generates |
Seb the issue is not with the actual type, rather than supporting the parsing of the |
|
@hishamco please try to repro the issue before and after updating yessql. Hopefully the yessql update should fix it. (irrespective of the tests which will need to be updated as you mentioned in your PR) |
I already reproduced the issue before, I might need to test it in the PR #14491 |
@sebastienros the issue still exists after updating the YesSQL |
Thanks, I will check then. Might need another yessql version :/ |
@lampersky 's explanation is correct. There is no issue. The query syntax is db agnostic, the However the resulting SQL SERVER query that OC generates might be better with using |
Describe the bug
The current SQL parser does not allow "N'" for Unicode
To Reproduce
Run the following SQL Query
SELECT * FROM ContentItemIndex Where ContentType Like N'%á%'
Result
*Syntax error, expected: ., (, +, -, , /, %, &, |, ^, =, >, <, >=, <=, <>, !=, !<, !>, AND, OR, LIKE, NOT LIKE, NOT, BETWEEN, IN, ,, ), GROUP, HAVING, ORDER, LIMIT, OFFSET, UNION, ;, WITH, SELECT, INNER, LEFT, RIGHT, JOIN, WHERE
The text was updated successfully, but these errors were encountered: