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

CLI does not support "catalog"."schema" qualified name for schema configuration #3979

Open
humpfhumpf opened this issue Nov 8, 2024 · 2 comments

Comments

@humpfhumpf
Copy link

humpfhumpf commented Nov 8, 2024

Some databases use extended schema name like "catalog"."schema" instead of simply "schema".

Currently on Flyway CLI, when flyway.schemas or flyway.defaultSchema configuration keys are set with catalog.schema value, CLI uses "catalog.schema" (instead of "catalog"."schema").

If I put "catalog"."schema" name in configuration, flyway CLI guess this erroneous schema: ""catalog"."schema""

One of the cause seems to be here: https://github.com/flyway/flyway/blob/main/flyway-core/src/main/java/org/flywaydb/core/internal/database/base/Schema.java#L221

Which version and edition of Flyway are you using?

10.17.1 Opensource edition.

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)

Main branch is also impacted: https://github.com/flyway/flyway/blob/main/flyway-core/src/main/java/org/flywaydb/core/internal/database/base/Schema.java#L221

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

CLI

Which database are you using? (Type & version)

Trino, but not releated to any specific database type.

Which operating system are you using?

Windows

What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)

see above

What did you expect to see?

see above

What did you see instead?

see above

@humpfhumpf humpfhumpf changed the title CLI does not support "catalog"."schema" extended name for schema configuration CLI does not support "catalog"."schema" qualified name for schema configuration Nov 8, 2024
@JasonLuo-Redgate
Copy link

JasonLuo-Redgate commented Nov 8, 2024

Hi @humpfhumpf ,
In this case, you need to include escape character. The below configuration in a toml file works:
defaultSchema = "\"catalog\".\"schema\""

@humpfhumpf
Copy link
Author

humpfhumpf commented Nov 8, 2024

Hi @JasonLuo-Redgate ,
With:

  • defaultSchema = "\"starburst_db\".\"demo_flyway\""
  • table = "flyway_history_demo_schema"
  • schemas = ["demo_schema"]

I get these messages with flyway migrate:

Creating schema """starburst_db"".""demo_flyway""" ...
Creating schema "demo_schema" ...
Creating Schema History table """starburst_db"".""demo_flyway"""."flyway_history_demo_schema" ...
[...]
DEBUG: Executing SQL: CREATE TABLE """starburst_db"".""demo_flyway"""."flyway_history_demo_schema" (
[...]
ERROR: Failed to execute operation in non-transactional context. Please restore backups and roll back database and code!

I am now wondering, if the trino plugin doesn't make some hard double-quoting...
What do you thing about the line https://github.com/flyway/flyway/blob/main/flyway-core/src/main/java/org/flywaydb/core/internal/database/base/Schema.java#L221 ?
It does hard double-quoting, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants