Closed
Description
Environment
Liquibase Version: 4.13
Liquibase Integration & Version: CLI
Liquibase Extension(s) & Version:
Database Vendor & Version: DB2z 12
Operating System Type & Version: Windows 10 Pro
Description
The primaryKeyExists precondition always returns false with DB2z if the schemaName attribute is omitted because the current schema is to be used.
Steps To Reproduce
Use
<changeSet labels="pk" author="a61kern" id="9.39-pk-0091">
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="AUTK01R"/>
<indexExists tableName="AUTK01R" columnNames="KAMP_ID"/>
<not>
<primaryKeyExists tableName="AUTK01R"/>
</not>
</and>
</preConditions>
<addPrimaryKey tableName="AUTK01R" columnNames="KAMP_ID"/>
</changeSet>
with an existing primary key.
Actual Behavior
The execution of the ChangeSet leads to the error message
Unexpected error running Liquibase: TABLE ENTW.AUTK01R ALREADY HAS A PRIMARY KEY OR UNIQUE CONSTRAINT WITH SPECIFIED COLUMNS AND PERIODS. SQLCODE=-624, SQLSTATE=42889, DRIVER=4.19.77 [Failed SQL: (-624) ALTER TABLE "ENTW".AUTK01R ADD PRIMARY KEY (KAMP_ID)]
because the primary key already exists and this is not recognized.
Expected/Desired Behavior
The existing primary key is recognized and the ChangeSet is marked as run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done