auto-rollback works on PostgreSQL, but not on Oracle.

Description

<changeSet id="4" author="bla">
<createTable tableName="foo">
<column name="id" type="bigint" />
<column name="bar" type="varchar(10)"/>
</createTable>
<addPrimaryKey tableName="foo" columnNames="id" constraintName="foo_pk" />
<insert tableName="foo">
<column name="id" valueNumeric="1"/>
<column name="bar" />
</insert>
<addNotNullConstraint tableName="foo" columnName="bar"/>
</changeSet>

This changeSet should fail and get rolled back, because we want to add a notnull constraint to the column "bar", which has a null value in entry 1.

  • Using it with PostgreSQL, the changeset fails and is rolled back, so we don't even have a table "foo". This is correct.

  • Using Oracle,the changeset also fails with an exception at the "addNotNullConstraint", but the table "foo" and the entry with id=1 are still there. Plus: There is NO entry in the "databasechangelog"-table for this changelog. So at the next try it will fail because the table "foo" already exists. That's not right, it should rollback all operations here the same as in PostegreSQL.

We have this problem also without the insert-statement, when using a already existing database and just add a column, so it's nothing about the insert-statement!

(table "bla" exists and contains some entries)
<changeSet id="4" author="bla">
<addColumn tableName="foo">
<column name="name" type="varchar(50)"/>
</addColumn>

<addNotNullConstraint tableName="foo" columnName="name" />
</changeSet>

Environment

Spring, Maven 3, PostgreSQL, Oracle

Activity

Show:

Attila Hajdu October 19, 2019 at 12:56 PM

Will it fixed or everybody should use "one change per changeSet" workaround?

Details

Reporter

Affects versions

Priority

Created February 3, 2012 at 10:19 AM
Updated October 19, 2019 at 12:56 PM