Skip to content
This repository was archived by the owner on Aug 10, 2026. It is now read-only.

feat: allow spaces in table/database names [DCI-752] - #30

Closed
eitamring wants to merge 1 commit into
mainfrom
feature/support-spaces-in-table-names
Closed

feat: allow spaces in table/database names [DCI-752]#30
eitamring wants to merge 1 commit into
mainfrom
feature/support-spaces-in-table-names

Conversation

@eitamring

Copy link
Copy Markdown

MySQL allows spaces in identifiers when quoted with backticks. The isSafeIdentifier validation was rejecting valid table names containing spaces.

MySQL allows spaces in identifiers when quoted with backticks.
The isSafeIdentifier validation was rejecting valid table names
containing spaces.
@snyk-io

snyk-io Bot commented Jan 8, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@aaronabv aaronabv changed the title feat: allow spaces in table/database names feat: allow spaces in table/database names [DCI-752] Jan 8, 2026
Comment thread canal/canal.go
func isSafeIdentifier(s string) bool {
for _, r := range s {
if !(unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '-') {
if !(unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '-' || r == ' ') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This addition will make space also a valid char like letters, digits etc.
Now sure this is our intention here. Why not just replace space with "_"? Already from Backend side, not here...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hey Aaron,

We can't normalize (replace space with _) on the backend side because of how the binlog listener works:

  1. The binlog streams events by actual table name - When MySQL sends binlog events, they contain the exact table name as it exists in the database (tbl_some_name _CC_triggered_email_list with the space)
  2. We filter which tables to listen to using IncludeTableRegex - This regex must match the exact table name from the binlog events
  3. If we normalize before receiving from backend:
    - Backend sends us tbl_...GI_CC... (normalized, with underscore)
    - Binlog streams events for tbl_..._GI CC... (actual name, with space)
    - They won't match → we miss all events for that table

The table name in IncludeTableRegex must be identical to what MySQL has, otherwise the binlog listener won't capture those events. We're not creating the space - we're just allowing it to pass through because the customer's MySQL database actually has a table with a space in its name.

@eitamring

Copy link
Copy Markdown
Author

Closing this PR. After discussion with product, we decided not to support table names with spaces in CDC. Instead, we'll add validation on the CDC side to raise a clear error during initialization when table names contain spaces, and block this in the UI mapping as well

@eitamring eitamring closed this Jan 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants