当前位置: 首页 > 知识库问答 >
问题:

运行Liquibase时出现意外错误:错误:关系“数据库日志”不存在

习斌
2023-03-14

在对新的postgres数据库运行liquibase(3.5.3版)部署时,我们会遇到以下错误。表databasechangelog不是由liquibase创建的,但表databasechangeloglock是创建的。

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

有两种模式,ods和audit。搜索路径是ods,audit,public。我们在连接字符串中指定目标模式(currentSchema=audit)。此外,我们成功地运行了ods模式。作为一种解决方法,我们可以手动创建日志表。然而,我想知道这是不是liquibase的一个bug,还是我们做错了什么?我认为liquibase在某种程度上看到了ods。databasechangelog并跳过创建它。

如有任何想法,我们将不胜感激。

m

共有1个答案

姜晨
2023-03-14

可能尝试使用以下liquibase参数:--defaultSchemaName=

 类似资料: