fix(jdbc): parse SQL queries containing empty string constant '' - #80
Open
arimu1 wants to merge 1 commit into
Open
fix(jdbc): parse SQL queries containing empty string constant ''#80arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
JdbcPatternParser treated the second quote in SQL '' as the start of a string literal, breaking pattern substitution for later bind parameters. Add a negative lookbehind so only opening quotes start a literal match. Fixes qos-ch#78 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
arimu1
force-pushed
the
fix/78-jdbc-empty-string-constant
branch
from
August 25, 2026 04:11
0ccc6a1 to
25d98e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
JdbcPatternParserso SQL empty string constants ('') no longer break detection of later log4j pattern literals (e.g.'%m').(?<!')toSTRING_LITERAL_PATTERNso only opening quotes start a string-literal match, not the closing quote of an adjacent''.testEmptyStringConstantregression test from SQL error in JDBC Appender if the sql query uses the empy string constant '' #78.Root cause
The previous regex
'((?>[^']|'')+)'could treat the second quote inNULLIF(a[2], '')as the start of a new string literal, leaving downstream pattern literals unparsed.Test plan
mvn test -Dtest=JdbcPatternParserTest— all 5 tests pass (including newtestEmptyStringConstant)mvn test— full suite passesFixes #78