lbitonti / liquibase-hana

Liquibase Hana extension
Apache License 2.0
11 stars 11 forks source link

Error on default schema #1

Closed MasterOdin closed 9 years ago

MasterOdin commented 9 years ago

When running this extension against Liquibase 3.2.2 I get the following error message:

INFO 9/25/14 10:58 AM: liquibase: Error getting default schema liquibase.exception.DatabaseException: Error executing SQL call current_schema: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "current_schema": line 1 col 6 (at pos 6)


This could be fixed by either overriding getConnectionSchemaName or getDefaultSchemaName (which I used to just return "SYSTEM" for our system)

You could try doing something like:

    @Override
    protected String getConnectionSchemaName() {
        if (getConnection() == null || getConnection() instanceof OfflineConnection) {
            return null;
        }
        try {
            return ExecutorService.getInstance().getExecutor(this).queryForObject(new RawSqlStatement("select current_schema from dummy"), String.class);
        } catch (Exception e) {
            LogFactory.getLogger().info("Error getting default schema", e);
        }
        return null;
    }

but this requires modifying the Liquibase dependency from 3.0 to a newer version which ends up breaking some other parts of the code (as the DataTypeFactory.getInstance().fromDescription method changed to require a second parameter, the database).