Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBZ-5917 Fix querying column metadata for tables with back slash in t… #4206

Merged
merged 1 commit into from Jan 19, 2023

Conversation

vjuranek
Copy link
Member

…he name

If the table contains back slash, which is ANSI SQL escape chracter, in its name, querying column metadata would fail in some cases (*) which would result into NPE. Fix table name before the query and escape escape character if the table name contains it.

Default backslash works for all currently supported databases as it's ANSI SQL standard, but in case of need it escape methods can be overridded respective subclasses.

(*) everything works when we collect column metadata for all tables, i.e. when there are no excluded tables

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

@@ -1223,11 +1224,23 @@ protected String resolveCatalogName(String catalogName) {
return catalogName;
}

protected static CharSequence getEscapeSequence() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@vjuranek Is not this a bit overkill? Cant' we just use String constant DEFAULT_ESCAPE_CHAR?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's here for the purpose we can override it in DB specific sub-classes if there is any other escape char. But given that \ is SQL standard, it's questionable if we will ever needed to use it. So yes, let's use simple approach and add possibility to override it when we really need it.

Copy link
Contributor

@jpechane jpechane left a comment

Choose a reason for hiding this comment

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

@vjuranek Could you please resolve the conflict? Feel free to merge the PR yourself after that.

…he name

If the table contains back slash, which is ANSI SQL escape chracter,
in its name, querying column metadata would fail in some cases (*)
which would result into NPE. Fix table name before the query and
escape escape character if the table name contains it.

Default backslash works for all currently supported databases as it's
ANSI SQL standard,

(*) everything works when we collect column metadata for all tables,
i.e. when there are no excluded tables
@vjuranek
Copy link
Member Author

Test failures are not related.

@vjuranek vjuranek merged commit f00f2a8 into debezium:main Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants