运行updateSQL第一次给数据库返回ROLLBACK错误DatabaseException

Running updateSQL for the first time gives database returned ROLLBACK error DatabaseException

我第一次将 Liquibase v3.9 与 PostgreSQL v11 一起使用。 第一次测试我的更新日志时,我 运行 更新 SQL 以查看 SQL 的输出 运行 对数据库。我收到此错误:

Unexpected error running Liquibase: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: The database returned ROLLBACK, so the transaction cannot be committed. Transaction failure cause is <<ERROR: relation "public.databasechangeloglock" does not exist
      Position: 22>>
    For more information, please use the --logLevel flag

发生这种情况是因为 updateSQL 期望 databasechangelog table 存在,如果这是您第一次针对数据库 运行ning Liquibase,那么那些 tables 将不会还存在(它们是在您第一次 运行 liquibase 更新时创建的)。

我认为这是 运行ning updateSQL 的有效用例,您可以在此处请求此功能:

https://github.com/liquibase/liquibase/issues

relation "public.databasechangeloglock" does not exist

我在容器中使用 PostgreSQL 时遇到了这个问题。

然后我意识到给PostgreSQL的内存限制是不够的。

将 PostgreSQL 内存限制增加到 512MiB 后问题解决了。