flyway / flyway-community-db-support

Offical Flyway Community Supported Database Plugins
https://flywaydb.org/
Apache License 2.0
5 stars 30 forks source link

Oceanbase integration causes issues with other databases #24

Closed Barry-RG closed 7 months ago

Barry-RG commented 8 months ago

When using Flyway with the flyway-database-oceanbase jar available in the Command Line and using a database like PostgreSQL, the query to check if the DatabaseType is correct is throwing the following error:

Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "LIKE"
  Position: 16

This is caused by the query in handlesDatabaseProductNameAndVersion which fails if the Database does not support that syntax. Unfortunately, for some databases, such as PostgreSQL, if a statment fails within a transaction then the whole transaction is marked as failed and errors any following statements.

Barry-RG commented 8 months ago

@whhe is there any other way with Oceanbase that we could detect it. Would the String databaseProductName, and databaseProductVersion from the JDBC metadata not be usable?

whhe commented 8 months ago

@whhe is there any other way with Oceanbase that we could detect it. Would the String databaseProductName, and databaseProductVersion from the JDBC metadata not be usable?

Sorry for the late reply. The databaseProductName returned by OceanBase is the compatibility mode, which is always 'MySQL' here. We can add a check case for it before the query.