4
votes

When running a liquibase (version 3.5.3) deployment against a new postgres database, we are getting the error below. The table, databasechangelog, did not get created by liquibase, but the table, databasechangeloglock, did get created.

INFO 2/7/17 1:27 PM: liquibase: Successfully acquired change log lock
INFO 2/7/17 1:27 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: ERROR: relation "audit.databasechangelog" does not exist
  Position: 20

 SEVERE 2/7/17 1:27 PM: liquibase: ERROR: relation "audit.databasechangelog" does
    not exist
      Position: 20
liquibase.exception.DatabaseException: Error executing SQL SELECT MD5SUM FROM au
dit.databasechangelog WHERE MD5SUM IS NOT NULL LIMIT 1: ERROR: relation "audit.d
atabasechangelog" does not exist
  Position: 20
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:68)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:126)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:134)
        at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:20
0)
        at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:19
4)
        at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChan
geLogHistoryService.java:212)
        at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1124)
        at liquibase.Liquibase.update(Liquibase.java:205)
        at liquibase.Liquibase.update(Liquibase.java:192)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "audit.databasecha
ngelog" does not exist
  Position: 20
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2455)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:2155)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:288)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)

        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303
)
        at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289
)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266
)
        at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:233)
        at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatem
ent(JdbcExecutor.java:345)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
        ... 11 more

There are two schemas, ods and audit. And the search_path is ods, audit, public. We specify the target schema in the connection string (currentSchema=audit). Additionally, we ran successfully against the ods schema. As a workaround, we can manually create the log table. However, I am wondering if this is a bug with liquibase or if we are doing something wrong? My thought is that liquibase is somehow seeing the ods.databasechangelog and skips creating it.

Any thoughts would be appreciated.

m

1

1 Answers

-1
votes

Maybe try to use following liquibase parameter: --defaultSchemaName=<schema>