如何在 PostgreSQL 上使用 java.lang.NumberFormatException 执行 liquibase
How to execute liquibase with java.lang.NumberFormatException on PostgreSQL
尝试在 PostgreSQL 9.3 数据库(从 PowerShell 脚本)的 liquibase 3.3.3 中执行 diffChangelog 为:
$_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 更新 45。(最新版本)。
postgresql-9.4-1201.jdbc4.jar位于C:\liquibase-3.3.3-bin\lib\目录下.
PostgreSQL 版本为 9.3。
有人知道如何修复此错误或使其正常工作吗?
非常感谢!
感谢 a_horse_with_no_name 和 Radek Postolowicz
为我指明了正确的方向。
问题是在 PostgreSQL table 中发现的,它将列 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
希望对您有所帮助。
尝试在 PostgreSQL 9.3 数据库(从 PowerShell 脚本)的 liquibase 3.3.3 中执行 diffChangelog 为:
$_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 更新 45。(最新版本)。
postgresql-9.4-1201.jdbc4.jar位于C:\liquibase-3.3.3-bin\lib\目录下.
PostgreSQL 版本为 9.3。
有人知道如何修复此错误或使其正常工作吗?
非常感谢!
感谢 a_horse_with_no_name 和 Radek Postolowicz
问题是在 PostgreSQL table 中发现的,它将列 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
希望对您有所帮助。