liquibase.exception.databaseexception:org.h2.dbc.jdbcbatchupdateexception:不能解析“日期”常数&quot dateadd(day,-2,curdate())

发布于 2025-01-25 18:17:03 字数 1136 浏览 1 评论 0原文

升级到Liquibase 3.9.0和H2 1.4.200之后,当尝试从CSV文件加载数据时,我会收到此错误消息。原因:liquibase.exception.databaseexception:org.h2.dbc.jdbcbatchupdateexception:不能解析“ date” date“ constand” dateadd(day,-2,curdate(curdate())”;它工作的最后版本是Liquibase 3.5.5和H2 1.4.197。

Bellow是CSV结构结构的一个示例:

ID; sender; client_code; status; title; streamfile_name; dovely_channel; tovelion_time; tovely_address; viewed_time; viewed_time; viseible_until; viseible_until; document_date ; client; test; user_interaction; test_document1; estdocument_1; null; null; null; null; null; null; null; dateadd(day,-2,curdate());

pom pom shise 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脚本:如果我是我是没有指定我收到上述错误的字段类型,如果我这样指定

列名=“ document_date” type =“ date

,然后我会收到一个错误,即该字段不能为null,因为不允许那里null值,并且由于无法解析liquibase fut null。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

反话 2025-02-01 18:17:04

H2没有currdate()。您应该使用 current_date 而不是。

H2 doesn't have currdate(). You should use current_date instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文