Repository navigation
fix(admin): use two-argument CONCAT for Oracle operation-log searches (#7738) - #7756
Merged
Merged
Conversation
Aias00
approved these changes
Oct 17, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Verified the fix is complete, not just locally correct.
Evidence
- Oracle's
CONCATaccepts exactly two arguments, soconcat('%', #{...}, '%')raises ORA-00909. The nested form is the standard workaround and is valid on MySQL, PostgreSQL and H2 as well, so keeping one statement without adatabaseIdvariant is the right call here. - Scope is complete:
concat(appears in exactly one mapper in the repository (operation-record-log-sqlmap.xml, both the keyword and the excluded predicate), and this PR fixes both. A repo-wide grep over*.xmlfinds no remaining three-argumentconcat. - Semantics unchanged:
'%' || kw || '%'is identical toconcat(concat('%', kw), '%'); wildcard placement,LIKE/NOT LIKEand the binds stay parameterised. - The statement-shape test has a real red-green: it asserts the absence of
concat('%',?,'%')as well as the presence of the nested form, so it cannot pass vacuously on master.
Non-blocking
- Two observations for the file rather than this PR: a
%inside the search term is still treated as a wildcard (pre-existingLIKEsemantics), and the same two predicates are duplicated betweenselectByConditionand the OracleselectLimitvariant — if either ever changes, both places need it.
I re-ran the shape test mentally against the generic statement too: because the shared statement has no databaseId, it still resolves under databaseId="oracle", so the test is exercising the statement users actually hit on Oracle.
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.
Fixes #7738.
Summary
Operation-log keyword/exclusion searches are generated by the shared
selectByConditionstatement with a three-argumentconcat('%', #{...}, '%'). Oracle only supports two-argumentCONCAT, so filtered searches fail on Oracle deployments.Modifications
concat(concat('%', #{...}), '%'), forcondition.keywordandcondition.excluded.databaseId="oracle".Verifying this change
New
OperationRecordLogConcatSqlTest: parses the mapper underdatabaseId="oracle"with non-empty keyword/excluded and asserts the SQL uses the nested two-argument form and never the three-argument form. Fails on the previous statement (concat('%',?,'%')), passes with the fix.Targeted test passes:
./mvnw -B -ntp -pl shenyu-admin test -Dtest=OperationRecordLogConcatSqlTest1/1 green.
H2 functional regression passes:
./mvnw -B -ntp -pl shenyu-admin test -Dtest=OperationRecordLogMapperTest2/2 green.
Checkstyle passes:
clean.
Notes
Only the expression nesting changes; wildcard placement and
LIKE/NOT LIKEsemantics stay identical on every dialect. NestedCONCATis supported by Oracle, MySQL, PostgreSQL and H2 alike, so no dialect-specific statement is needed.