angbisoft opened a new issue #10952:
URL: https://github.com/apache/druid/issues/10952
### Affected Version
The v1.2.5 of Druid.
### Description
Please include as much detailed information about the problem as possible.
Druid can parse this query just fine (notice unicode, i.e. Turkish
characters in schema)
```
select [Ülke]
from [Örnek VeriTabanı].dbo.[MÜŞteri Bilgisi]
```
However, it fails to parse the same query
```
select Ülke
from [Örnek VeriTabanı].dbo.[MÜŞteri Bilgisi]
```
with an
```
com.alibaba.druid.sql.parser.ParserException: illegal identifier. pos 7,
line 1, column 8, token SELECT
at com.alibaba.druid.sql.parser.Lexer.scanIdentifier(Lexer.java:2282)
at com.alibaba.druid.sql.parser.Lexer.nextToken(Lexer.java:1126)
at
com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerSelectParser.query(SQLServerSelectParser.java:132)
at
com.alibaba.druid.sql.parser.SQLSelectParser.query(SQLSelectParser.java:374)
at
com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerSelectParser.select(SQLServerSelectParser.java:48)
at
com.alibaba.druid.sql.parser.SQLStatementParser.parseSelect(SQLStatementParser.java:4190)
at
com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:204)
at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:562)
at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:556)
at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:579)
```
error. Note that, both of the queries are valid T-SQL statements and Ms Sql
Server can parse (and return the same result) without any problems. Actually, I
expect that
```
@Test
public void withBracketsTest() {
var sql = "select [Ülke]\n from [Örnek
VeriTabanı].dbo.[MÜŞteri Bilgisi]";
assertDoesNotThrow(() -> SQLUtils.parseSingleStatement(sql,
DbType.sqlserver.toString()));
}
@Test
public void withoutBracketsTest() {
var sql = "select Ülke\n from [Örnek VeriTabanı].dbo.[MÜŞteri
Bilgisi]";
assertDoesNotThrow(() -> SQLUtils.parseSingleStatement(sql,
DbType.sqlserver.toString()));
}
```
both of these test to pass. Although `withBracketsTest` test passes
`withoutBracketsTest` fails.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]