尝试在 PostgreSQL 9.3 数据库上的 liquibase 3.3.3 中执行 diffChangelog(来自 PowerShell 脚本):
$_cmd='C:\liquibase-3.3.3-bin\liquibase
--driver=org.postgresql.Driver
--url=jdbc:postgresql://localhost:5432/chaos
--username=postgres --password=Password
diffChangelog
--referenceUrl=jdbc:postgresql://xxx.xxx.xxx.xxx:5432/chaos
--referenceUsername=postgres --referencePassword=Password > db-changelog.xml';
CMD.EXE /c "`"$_cmd`""
我收到错误:
*CMD.EXE : Unexpected error running Liquibase:
liquibase.exception.DatabaseException: java.lang.NumberFormatException:
For input string: "B'00000000'::"bit""*
我正在使用 Java 版本 8 update 45。(最新版本)。
postgresql-9.4-1201.jdbc4.jar 位于 C:\liquibase-3.3.3-bin\lib\目录中。
PostgreSQL 版本为 9.3。
有人知道如何修复此错误或使其正常工作吗?
提前非常感谢!
最佳答案
感谢 a_horse_with_no_name 和 Radek Postolowicz previous question为我指明了正确的方向。
该问题是在 PostgreSQL 表中发现的,该表将列 qstatus 定义为:
qstatus bit(8) DEFAULT B'00000000'::"bit" <--**HERE IS THE PROBLEM!
各方都正确解释了 PostgreSQL bytea 数据类型。
删除此列可以解决所有问题。
进一步的测试(对我来说)表明,任何使用强制转换定义的列都会在 liquibase 中失败:
例如,
qstatus bit(8) DEFAULT B'00000000'::"bit"
或
cmi character varying(1) DEFAULT ' '::bpchar
希望这有帮助。
关于java - 如何在 PostgreSQL 上使用 java.lang.NumberFormatException 执行 liquibase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30521377/