| Bug #106240 | StringIndexOutOfBoundsException when VALUE is at the end of the query | ||
|---|---|---|---|
| Submitted: | 21 Jan 2022 22:00 | Modified: | 29 Mar 2022 22:25 | 
| Reporter: | YIYI DENG | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) | 
| Version: | 8.0.25, 8.0.28 | OS: | Any | 
| Assigned to: | CPU Architecture: | Any | |
| Tags: | StringIndexOutOfBoundsException, VALUES() | ||
   [21 Jan 2022 22:00]
   YIYI DENG        
  
 
   [21 Jan 2022 22:17]
   YIYI DENG        
  The first case is just found to be the same as in https://bugs.mysql.com/bug.php?id=84365, but the second case should be a new one.
   [22 Jan 2022 7:40]
   MySQL Verification Team        
  Hello YIYI DENG, Thank you for the report and feedback. Verified as described. regards, Umesh
   [24 Jan 2022 15:56]
   YIYI DENG        
  Hello, Bug84365 is different from the second case I proposed. Case for Bug84365 is "insert into testBug84365(id, name) VALUES(?,?) on duplicate key update id = values(id) + 1". My case is a wrong syntax query, literally an empty values function, "insert into test_empty_values(a, b) values". My point is instead of throwing StringIndexOutOfBoundsException, we should throw syntax error (SQLSyntaxErrorException) instead to handle such case properly.
   [29 Mar 2022 22:25]
   Daniel So        
  Posted by developer: Added the following entry to the Connector/J 8.0.29 changelog: "When using client-side prepared statements, if the VALUES clause came after the ON DUPLICATE KEY UPDATE clause or it came at the end of the statement, a StringIndexOutOfBoundsException was thrown. This patch refactors the query parser to fix the problem behind issue, and also to improve the parser's performance. "

