Table creation fails with H2 v2 when a change set specifies an integer size, e.g. INT(10)
See original GitHub issueEnvironment
Liquibase Version: 4.9.1
Liquibase Integration & Version: SpringBoot v2.7.3
Database Vendor & Version: H2 v2.1.214
Operating System Type & Version: MacOS v12.5
Description
Since upgrading to H2 v2 my change set no longer applies.
Steps To Reproduce
Create a change set such as this:
<changeSet author="mark" id="createPersonsTable">
<createTable tableName="persons">
<column name="personId" type="INT(10)"/>
<column name="lastName" type="VARCHAR(255)"/>
<column name="firstName" type="VARCHAR(255)"/>
<column name="address" type="VARCHAR(255)"/>
<column name="city" type="VARCHAR(255)"/>
</createTable>
</changeSet>
The magic part is the INT(10)
.
Recreation is here.
Actual Behavior
An exception is throw: -
2022-09-07 10:11:41.855 WARN 23829 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set changelog/1.0.0/tables/create_persons_table.xml::createPersonsTable::mark:
Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "CREATE TABLE PUBLIC.persons (personId INT[*](10), lastName VARCHAR(255), firstName VARCHAR(255), address VARCHAR(255), city VARCHAR(255))"; expected "ARRAY, INVISIBLE, VISIBLE, NOT NULL, NULL, AS, DEFAULT, GENERATED, ON UPDATE, NOT NULL, NULL, AUTO_INCREMENT, DEFAULT ON NULL, NULL_TO_DEFAULT, SEQUENCE, SELECTIVITY, COMMENT, CONSTRAINT, COMMENT, PRIMARY KEY, UNIQUE, NOT NULL, NULL, CHECK, REFERENCES, AUTO_INCREMENT, ,, )"; SQL statement:
CREATE TABLE PUBLIC.persons (personId INT(10), lastName VARCHAR(255), firstName VARCHAR(255), address VARCHAR(255), city VARCHAR(255)) [42001-214] [Failed SQL: (42001) CREATE TABLE PUBLIC.persons (personId INT(10), lastName VARCHAR(255), firstName VARCHAR(255), address VARCHAR(255), city VARCHAR(255))]
Expected/Desired Behavior
The table should be created.
Additional Context
The above change set works fine when using H2 v1.x.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
org.h2.jdbc.JdbcSQLSyntaxErrorException after H2 version ...
I was facing the same issue when updating the h2 version from 1.4.200 to 2.0.206. The project is based on Spring Boot and...
Read more >Data Types - H2 Database Engine
BINARY VARYING BINARY LARGE OBJECT BOOLEAN TINYINT SMALLINT, INTEGER BIGINT NUMERIC ... For variable-length strings use CHARACTER VARYING data type instead.
Read more >Unique Constraints and Check Constraints - SQL Server
When a UNIQUE constraint is added to an existing column or columns in the table, by default, the Database Engine examines the existing...
Read more >4.5.4 mysqldump — A Database Backup Program
It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in...
Read more >The Variant Call Format (VCF) Version 4.2 Specification
indicate that at this site the quality is below 10 and the number of samples with data is ... membership (e.g. H2 indicates...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is the desired effect yeah. Thanks for looking into this.
Hi @cwrsimon, no worries. We have coded a solution for this type of issue for the different data types people are experiencing this type of issue on H2. If you have any feedback, concern, or any other use case about this issue you can think of please don’t hesitate to share it with us.
Thanks, Daniel.