带有 Postgres 的 Liquibase,更改日志参数未被替换

Liquibase with Postgres, changelog parameters are not replaced

我将 liquibase 与 oracle 和 postgres 一起使用,我想使用 changeLog 属性来自定义两个数据库中不同的 changeSets 元素。

我正在使用 https://www.liquibase.org/documentation/changelog_parameters.html 中的示例。

这是我的数据库-changelog.xml

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

    <property name="table.name" value="table_O" dbms="oracle"/>
    <property name="table.name" value="table_P" dbms="postgres"/>

    <property name="column1.name" value="column1_O" dbms="oracle"/>
    <property name="column1.name" value="column1_P" dbms="postgres"/>

    <property name="column2.name" value="column2_O" dbms="oracle"/>
    <property name="column2.name" value="column2_P" dbms="postgres"/>

    <property name="clob.type" value="blob" dbms="oracle"/>
    <property name="clob.type" value="bytea" dbms="postgres"/>

    <changeSet id="1" author="joe">
         <createTable tableName="${table.name}">
             <column name="id" type="int"/>
             <column name="${column1.name}" type="${clob.type}"/>
             <column name="${column2.name}" type="int"/>
         </createTable>
    </changeSet>
</databaseChangeLog>

命令

$ liquibase --driver=oracle.jdbc.OracleDriver \
            --classpath=ojdbc8-18.3.0.0.jar \
            --changeLogFile=db.changelog.test.xml \
            --url=jdbc:oracle:thin:@localhost:1521/my_db \
            --username=my_user \
            --password=my_pwd \
            --logLevel debug updateSQL > simple_changeLog_ORACLE.sql

工作正常,我获得了 oracle 的更新日志,但是命令

$ liquibase --driver=org.postgresql.Driver \
            --classpath=postgresql-42.2.5.jar \
            --changeLogFile=db.changelog.test.xml \
            --url=jdbc:postgresql://localhost:15432/my_db \
            --username=my_user \
            --password=my_pwd \
            --logLevel debug updateSQL > simple_changeLog_POSTGRES.sql

失败并出现以下异常

java.lang.ArrayIndexOutOfBoundsException: 1
        at liquibase.datatype.DataTypeFactory.fromDescription(DataTypeFactory.java:251)
        at liquibase.change.core.CreateTableChange.generateStatements(CreateTableChange.java:70)
        at liquibase.change.AbstractChange.generateStatementsVolatile(AbstractChange.java:287)
        at liquibase.change.AbstractChange.warn(AbstractChange.java:358)
        at liquibase.changelog.visitor.ValidatingVisitor.visit(ValidatingVisitor.java:110)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
        at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:284)
        at liquibase.Liquibase.update(Liquibase.java:198)
        at liquibase.Liquibase.update(Liquibase.java:274)
        at liquibase.Liquibase.update(Liquibase.java:251)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1433)
        at liquibase.integration.commandline.Main.run(Main.java:229)
        at liquibase.integration.commandline.Main.main(Main.java:143)

选项 --logLevel debug 显示解析的 changeSet 中的差异。

甲骨文是

17:59:43.184 DEBUG [liquibase.util.MD5Util]: Computed checksum for createTable:[
    columns=[
        [
            name="id"
            type="int"
        ],
        [
            name="column1_O"
            type="blob"
        ],
        [
            name="column2_O"
            type="int"
        ]
    ]
    tableName="table_O"
] as 836321c599b350ca366cc6ea3bde3890

而 postgres 是

17:51:55.864 DEBUG [liquibase.util.MD5Util]: Computed checksum for createTable:[
    columns=[
        [
            name="id"
            type="int"
        ],
        [
            name="${column1.name}"
            type="${clob.type}"
        ],
        [
            name="${column2.name}"
            type="int"
        ]
    ]
    tableName="${table.name}"
] as 71476a8361010689730a8bf91f8d7115

我是不是漏掉了什么?

我认为唯一的问题是用于 postgres 的值是 postgresql 而不仅仅是 postgres

数据库名称列表位于 https://www.liquibase.org/databases.html