Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase creates table "user" in lower case for H2 database #2701

Closed
ssg-stsc opened this issue Mar 30, 2022 · 3 comments
Closed

Liquibase creates table "user" in lower case for H2 database #2701

ssg-stsc opened this issue Mar 30, 2022 · 3 comments
Labels
autocandidate casing DBH2 IntegrationSpringboot RiskHigh Items that require more extensive testing, change an existing API, or add new features. sprint2022-30 TypeDataType TypeIncorrectSQL ver4.7.0

Comments

@ssg-stsc
Copy link

ssg-stsc commented Mar 30, 2022

Environment

Liquibase Version: 4.7.0

Liquibase Integration & Version: spring-boot 2.6.3

Liquibase Extension(s) & Version: -

Database Vendor & Version: H2 1.4.200

Operating System Type & Version: -

Description

Since liquibase version 4.7.0 my spring-boot integration tests fail for a table named "user" with the following exception: org.h2.jdbc.JdbcSQLSyntaxErrorException: table "USER" not found.

The changelog file uses tableName="user" in the createTable section for creating this table.

I checked the generated SQL-statement for this table which looks like this:
CREATE CACHED TABLE "PUBLIC"."user" (...)

In version 4.6.2 the tests still worked. The generated SQL-statement in this version looked like this:
CREATE CACHED TABLE "PUBLIC"."USER" (...)

So apparently the table name changed to lower-case in the SQL-statement.
However, the "user" table is the only table which is created in lower-case after the version update. All other tables are also defined in lower-case in the changelog, but the generated SQL is still in upper-case.

I noticed you changed the H2 version with 4.7.0 (#2285) which added some new H2 keywords, including "user". It seems there is some sort of special treatment for this case.

I found a workaround for this issue by explicitly using an upper-case name in the createTable section of the changelog. Still I think it's confusing that only this table uses lower case.

Steps To Reproduce

List the steps to reproduce the behavior.

  • create a changlog file with a table named "user"
  • run a spring-boot integration test which uses the "UserRepository"

Actual Behavior

A clear and concise description of what happens in the software with the version used.

  • org.h2.jdbc.JdbcSQLSyntaxErrorException: table "USER" not found exception is thrown

Expected/Desired Behavior

A clear and concise description of what happens in the software after a fix is created and merged.

  • spring-boot integration tests can handle tables which uses H2 keywords as table name, even when defined in lower case.
@kataggart
Copy link
Contributor

@ssg-stsc Thanks for submitting this. There is a bit of discussion on the same/similar issue here #2385 if you wanted to follow along there as well. Will work towards resolution of these both. Thanks.

@kataggart kataggart added this to To Do in Conditioning++ via automation Mar 30, 2022
@ssg-stsc
Copy link
Author

Thanks for the mentioned issue, I was trying to find a similar issue but apparently missed this one.
I am curious for any updates on this, but in the meantime I will use my workaround and change the table name.

@kataggart kataggart added daily_review RiskHigh Items that require more extensive testing, change an existing API, or add new features. labels Apr 19, 2022
@kataggart
Copy link
Contributor

duplicate/tracking fix/discussion #2385

@kataggart kataggart closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2022
Conditioning++ automation moved this from To Do to Done Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocandidate casing DBH2 IntegrationSpringboot RiskHigh Items that require more extensive testing, change an existing API, or add new features. sprint2022-30 TypeDataType TypeIncorrectSQL ver4.7.0
Projects
Archived in project
Development

No branches or pull requests

3 participants