CONJ-1283: only allow a single VALUES() block to be repeated #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket in CONJ issue tracker: https://jira.mariadb.org/browse/CONJ-1283
Earlier ticket: https://jira.mariadb.org/browse/CONJ-1238
It appears that this commit introduced a bug on the newly-reinstated
rewriteBatchedStatements
connection property. The commit landed between the 3.5.5 and 3.5.6 releases.When the following query is rewritten, only the initial (?,?) block should be repeated in the rewritten SQL:
but it looks like we're repeating from the first parenthesis to the very last parenthesis
I think this might be an intentional change in order to handle multiple VALUES blocks; e.g.
which has been added as a test case in ClientRewritableParserTest here: https://github.com/mariadb-corporation/mariadb-connector-j/blob/main/src/test/java/org/mariadb/jdbc/unit/util/ClientParserRewritableTest.java#L93
but the original
rewriteBatchedStatements
code didn't rewrite those statements, so I've reverted back to that behaviour in the fix.The fix in this PR reverts back to the previous parenthesis-handling behaviour in ClientParser, but keeps the other changes on that commit. I've kept the fix simple as I think we'd want to get this merged ASAP to fix the bug in the main branch.
Let me know if we need to include multiple VALUES blocks in the repeating section. Should be able to do that and still support brackets in the DUPLICATE KEY UPDATE clause, but it will be a more complicated fix in the ClientParser code.