terrymanu commented on issue #37973:
URL: 
https://github.com/apache/shardingsphere/issues/37973#issuecomment-3860108599

   Problem Understanding
   
     - You hit DialectSQLParsingException on SQLServer SET QUOTED_IDENTIFIER / 
SET TEXTSIZE in 5.5.2, and on master you don’t see SQLServer DAL grammar, so 
you wonder if these statements were dropped or never migrated.
   
     Root Cause
   
     - It’s a parser coverage gap, not a usage issue: the SQLServer dialect 
never implemented session-level SET statements (including QUOTED_IDENTIFIER / 
TEXTSIZE), so the parser cannot recognize them.
   
     Problem Analysis
   
     - On master, SQLServer DAL grammar only defines EXPLAIN 
(parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DALStatement.g4);
 there is no SET statement rule.
     - The entry grammar SQLServerStatement.g4 does not route to a general SET 
<option> branch, only to transactional setTransaction / setImplicitTransactions 
and setUser 
(parser/sql/engine/dialect/sqlserver/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/
       SQLServerStatement.g4).
     - The lexer lacks a TEXTSIZE keyword; QUOTED_IDENTIFIER exists but is only 
used inside ALTER DATABASE ... SET ... options 
(parser/sql/engine/dialect/sqlserver/src/main/antlr4/imports/sqlserver/DDLStatement.g4),
 not as a standalone SET statement.
     - The 5.5.2 tag shows the same content, so this functionality was never 
implemented rather than lost in a migration.
   
     Conclusion
   
     - This is a real parser bug/missing feature in the SQLServer dialect: 
session-level SET statements (including QUOTED_IDENTIFIER / TEXTSIZE) are not 
supported and need grammar/visitor additions plus tests.
     - Design suggestion: add the missing keywords (e.g., TEXTSIZE) to 
SQLServerKeyword.g4; introduce a dedicated SET statement rule in the SQLServer 
grammar (DAL or a separate rule) that covers session-level options; wire it 
into SQLServerStatement.g4; implement the
       corresponding visitor handling; add focused unit tests (one public 
method per scenario) for these statements.
     - Warm invitation: we’d love a PR against master to implement and test 
this; the community team will gladly review and help land it.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to