Skip to content

Conversation

@inhuman
Copy link

@inhuman inhuman commented Feb 18, 2020

Fix case when db name with a hyphen throws error

Syntax error: failed at position 28: -service-staging LIKE 'schema_migrations'. Expected one of: LIMIT, SETTINGS, FORMAT, NOT, LIKE, INTO OUTFILE in line 0: SHOW TABLES FROM super-service-staging LIKE 'schema_migrations'

@coveralls
Copy link

coveralls commented Feb 18, 2020

Pull Request Test Coverage Report for Build 691

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 52.382%

Totals Coverage Status
Change from base Build 689: 0.0%
Covered Lines: 2496
Relevant Lines: 4765

💛 - Coveralls

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

What if the database name contains a backtick? I think that's a valid name: https://clickhouse.tech/docs/en/query_language/syntax/#syntax-identifiers

There are other places where config.DatabaseName is used and config.MigrationsTable will have the same problem. Let's completely fix this issue by:

  1. Adding an escaping or quoting method to quote identifiers like pq's
    • Don't forget to add tests for this
  2. Updating all usages of config.DatabaseName and config.MigrationsTable to use the quote identifier method above

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.

3 participants