'liquibase.exception.DatabaseException: org.h2.jdbc.JdbcBatchUpdateException: Cannot parse "DATE" constant "DATEADD(DAY,-2,CURDATE())
after upgrading to liquibase 3.9.0 and h2 1.4.200, I'm receiving this error message when trying to load data from a csv file. Reason: liquibase.exception.DatabaseException: org.h2.jdbc.JdbcBatchUpdateException: Cannot parse "DATE" constant "DATEADD(DAY,-2,CURDATE())"; Last versions it worked were liquibase 3.5.5 and h2 1.4.197.
Bellow is an example of how the csv is structured :
id;sender;client_code;status;title;streamfile_name;delivery_channel;delivery_time;delivery_address;viewed_time;visible_until;document_date; Client;Test;USER_INTERACTION;test_document1;ESTDOCUMENT_1;null;null;null;null;null;DATEADD(DAY,-2,CURDATE());
POM looks like this:
<liquibase.version>3.9.0</liquibase.version>
<liquibase-hibernate5.version>3.8</liquibase-hibernate5.version>
<h2.version>1.4.200</h2.version>
<validation-api.version>2.0.1.Final</validation-api.version>
liquibase script:If I am not specifying the type of the field I receive the error mentioned above, if I specify it like this
column name="document_date" type="date
Then I am receiving an error that the field cannot be null, as null values are not allowed there and because it cannot be parsed liquibase puts null.
Solution 1:[1]
H2 doesn't have currdate(). You should use current_date instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bilak |
