Skip to content

DBZ-8170 Error caused by database name containing regular keywords#5800

Merged
jpechane merged 1 commit intodebezium:mainfrom
jw-itq:DBZ-8170
Jan 30, 2026
Merged

DBZ-8170 Error caused by database name containing regular keywords#5800
jpechane merged 1 commit intodebezium:mainfrom
jw-itq:DBZ-8170

Conversation

@jw-itq
Copy link
Contributor

@jw-itq jw-itq commented Aug 28, 2024

https://issues.redhat.com/browse/DBZ-8170

Error caused by database name containing regular keywords, such as database name: test$user

@github-actions
Copy link

Welcome as a new contributor to Debezium, @jw-itq. Reviewers, please add missing author name(s) and alias name(s) to the COPYRIGHT.txt and Aliases.txt respectively.

@Naros
Copy link
Member

Naros commented Aug 29, 2024

Hi @jw-itq would it be possible to add a test not only for the use case you've described with test$user, but also checking what this change will do should the configuration supply the regular expression contain escaped syntax values, such as test\$user, does this cause such a configuration to no longer work or be interpreted incorrectly?

@jw-itq
Copy link
Contributor Author

jw-itq commented Aug 29, 2024

Hi @jw-itq would it be possible to add a test not only for the use case you've described with test$user, but also checking what this change will do should the configuration supply the regular expression contain escaped syntax values, such as test\$user, does this cause such a configuration to no longer work or be interpreted incorrectly?

thanks, I will attempt to add a test case. Yes, this could potentially cause test$user not to be interpreted correctly. However, on the JDBC URL, you cannot use $ but you can use \$. If the Matcher.quoteReplacement is used, test$user will still be effective.

@Naros
Copy link
Member

Naros commented Aug 29, 2024

Hi @jw-itq would it be possible to add a test not only for the use case you've described with test$user, but also checking what this change will do should the configuration supply the regular expression contain escaped syntax values, such as test\$user, does this cause such a configuration to no longer work or be interpreted incorrectly?

thanks, I will attempt to add a test case. Yes, this could potentially cause test$user not to be interpreted correctly. However, on the JDBC URL, you cannot use $ but you can use $. If the Matcher.quoteReplacement is used, test$user will still be effective.

But you're also adjusting the Predicates class which is used for many other configuration options such as the include and exclude list configurations that we've always communicated that special regex characters should be escaped if they're part of the database, schema, or table name. So we need to consider all those variants with this change imo.

@jw-itq
Copy link
Contributor Author

jw-itq commented Aug 29, 2024

Hi @jw-itq would it be possible to add a test not only for the use case you've described with test$user, but also checking what this change will do should the configuration supply the regular expression contain escaped syntax values, such as test\$user, does this cause such a configuration to no longer work or be interpreted incorrectly?

thanks, I will attempt to add a test case. Yes, this could potentially cause test$user not to be interpreted correctly. However, on the JDBC URL, you cannot use $ but you can use $. If the Matcher.quoteReplacement is used, test$user will still be effective.

But you're also adjusting the Predicates class which is used for many other configuration options such as the include and exclude list configurations that we've always communicated that special regex characters should be escaped if they're part of the database, schema, or table name. So we need to consider all those variants with this change imo.

thanks, the Predicate indeed requires more thought, and I will reconsider the changes regarding the Predicate. Or do you have any better suggestions?

Copy link

@Ritabrata1080 Ritabrata1080 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash the commits to have a linear history.

@Naros
Copy link
Member

Naros commented Jan 6, 2026

❌ Developer Certificate of Origin (DCO) check failed.

Hi @jw-itq, please sign off all commits with:

git commit -s

If pull request commits are not signed off, the pull request cannot be merged. For more information about why this is required, please see our blog about contribution requirement changes.

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 6, 2026

❌ Developer Certificate of Origin (DCO) check failed.

Hi @jw-itq, please sign off all commits with:

git commit -s

If pull request commits are not signed off, the pull request cannot be merged. For more information about why this is required, please see our blog about contribution requirement changes.

ok, thanks. I'll handle it right away.

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 6, 2026

Please squash the commits to have a linear history.

ok!

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 7, 2026

@Naros @Ritabrata1080 hi,commits squashed and DCO sign-off added.


public static <T, U> BiPredicate<T, U> includes(String regexPatterns, BiFunction<T, U, String> conversion) {
Set<Pattern> patterns = Strings.setOfRegex(regexPatterns, Pattern.CASE_INSENSITIVE);
Set<Pattern> patterns = Strings.setOfRegex(regexPatterns != null ? Matcher.quoteReplacement(regexPatterns) : null, Pattern.CASE_INSENSITIVE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if patterns set tries to set regex of null value ? Please check for potential NPE crash across patch.

@jw-itq jw-itq force-pushed the DBZ-8170 branch 3 times, most recently from 80bc397 to e85dd76 Compare January 12, 2026 03:22
*/
public static <T> Predicate<T> includes(String regexPatterns, Function<T, String> conversion) {
Set<Pattern> patterns = Strings.setOfRegex(regexPatterns, Pattern.CASE_INSENSITIVE);
Set<Pattern> patterns = Strings.setOfRegex(regexPatterns != null ? Matcher.quoteReplacement(regexPatterns) : null, Pattern.CASE_INSENSITIVE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've always expected that if a provided include/exclude list configuration property contains regex characters that may not be interpreted as literal, they should be manually escaped in the configuration. This change here would specifically create breaking behavior in environments that already pre-escape special characters.

I'm personally not convinced we should change this behavior, as using $ and, to a lesser degree, ? in tablenames is quite common among certain database vendors. I am concerned about the potential impact on a longstanding expectation when handling these strings.

When it comes to the JDBC URL, we can certainly be significantly more lenient there.
@jpechane any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we should not break backward compatibility in this regard.

@jw-itq jw-itq force-pushed the DBZ-8170 branch 2 times, most recently from b05dab0 to 79aa9bb Compare January 14, 2026 14:51
@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 14, 2026

@Naros @Ritabrata1080 @jpechane Thank you for your review. I will revert the changes made to Predicates.java

@jpechane
Copy link
Contributor

@jw-itq LGTM. Could you please rebase the PR on the latest main and add a test case if possible to make sure the results are expected?

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 15, 2026

@jw-itq LGTM. Could you please rebase the PR on the latest main and add a test case if possible to make sure the results are expected?

@jpechane ok.I see that the latest version has been updated. Do we not need to proceed with the current PR?

@jpechane
Copy link
Contributor

@jw-itq Please take a lok at the PR changes. I belive it is broken now.

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 16, 2026

@jw-itq Please take a lok at the PR changes. I belive it is broken now.

@jpechane hi. the JdbcConnection.java fix using Matcher.quoteReplacement() is already present in the main branch (commit fe5758e or earlier). After rebasing, my PR now only contains contributor information updates. Should I close this PR since the actual fix is already merged, or would you like me to keep it for the contributor credits?

@jpechane
Copy link
Contributor

@jw-itq Please keep the credits, just it is necessary to rebase on the latest main and remove the extra lines ike <<<<<

@jw-itq
Copy link
Contributor Author

jw-itq commented Jan 28, 2026

@jw-itq Please keep the credits, just it is necessary to rebase on the latest main and remove the extra lines ike <<<<<

@jpechane Thanks! Done.

@jpechane jpechane merged commit 5adf12e into debezium:main Jan 30, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants