I have a hobby project running on Boot 2.7 snapshot and today the project stopped working because of the Liquibase 4.7.0 upgrade unfortunately.

The issue could be completely on my side but maybe it's deeper so I wanted to mention it here.

With Liquibase 4.6.2 and H2 datasource the following changelog

databaseChangeLog:
  - changeSet:
      id: 1
      author: me
      changes:
        - createTable:
            tableName: user
            columns:
              - column:
                  name: id
                  type: int
                  autoIncrement: true
                  constraints:
                    nullable: false
                    primaryKey: true
                    primaryKeyName: user_pk
              - ..

will create UPPERCASE tables in H2:

SpringBoot Liquibase 4.7.0 upgrade causing issue

In fact I never really paid attention to the uppercase/lowercase table/column name in the H2 console despite having them lowercase in the changelog.

Also a changelog like this (lowercase names) works:

        - insert:
            tableName: user_role
            columns:
              - column:
                  name: user_id
                  valueComputed: select id from user where username = 'foo_bar'
              - column:
                  name: role_name
                  value: ROLE_USER

Doing some manual queries in the H2 console work for these:

  • SELECT * FROM USER
  • SELECT * FROM user
  • SELECT * FROM "USER"

but not for SELECT * FROM "user"

A simple JPA @Entity without any special naming configuration like below works as well using Spring Data JPA:

@Entity
@Getter
@Setter
public class User implements Serializable {

    ..
}

Now with upgrade to Liquibase 4.7.0 upgrade in Boot I see other behaviour with above setup.

The application won't start as the changelog with the insert fails now:

Reason: liquibase.exception.DatabaseException: Table "USER" not found; SQL statement:
INSERT INTO PUBLIC.user_role (user_id, role_name) VALUES (select id from user where username = 'foo_bar', 'ROLE_USER') [42102-200] [Failed SQL: (42102) INSERT INTO PUBLIC.user_role (user_id, role_name) VALUES (select id from user where username = 'foo_bar, 'ROLE_USER')]

Although "USER" (uppercase) is not used like that in the insert it still fails.

Now I probably should have not used the table name user as USER is a reserved word, so I can only blame myself ;-) but this might impact others as well...

Setting ext["liquibase.version"] = "4.6.2" in my project at least makes the project run again for now. In the Liquibase 4.7.0 release notes I also see nothing noteworthy.

Comment From: wilkinsona

Thanks for the report. Given that things work as you expected with no changes other than downgrading Liquibase, I think this should be reported to the Liquibase team. It may be an intentional change in 4.7 to which you'll have to adapt, or it may be a bug that they'll want to correct. Either way, I don't think there's anything that would should do in Spring Boot as we don't want our next minor release (2.7) to get stuck on an older minor of Liquibase (4.6).

Comment From: marceloverdijk

I will create a issue on liquibase project to understand if behavior changed or if there is a bug.

Comment From: marceloverdijk

For reference: https://github.com/liquibase/liquibase/issues/2385