Invalid Reorg table statement gets generated on DB2

Description

When I have a changeset like this:

<changeSet author="aaa" id="bbb">
<createTable tableName="FOOBAR">
<column name="A" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="B" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey tableName="FOOBAR" columnNames="A,B"
constraintName="PK_FOOBAR"/>
</changeSet>

LiquiBase will throw an error because it seems to execute the addPrimaryKey command before the createTable command.

In particular the SQL statement "CALL SYSPROC.ADMIN_CMD ('REORG TABLE xxx.FOOBAR');" is getting executed while table FOOBAR does not exist yet on the database.

This is the error:
liquibase.exception.DatabaseException: Error executing SQL CALL SYSPROC.ADMIN_CMD ('REORG TABLE xxx.FOOBAR'): DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=.FOOBAR;<Kennung>;RECLAIM, DRIVER=4.16.53

Environment

Windows 7 x64, DB2 10.1

Reporter

Marco Perazzo

Fix versions

Affects versions

Priority

Blocker
Configure