Skip to content

Define length limits for non-LOB data types #2832

@mrigger

Description

@mrigger

Consider the following test case:

CREATE TABLE T0(c0 BINARY(1500000000));
INSERT INTO T0(c0) VALUES (0);
DELETE FROM T0; -- General error: "java.lang.NegativeArraySizeException: -1294959092"

Unexpectedly, the DELETE results in an exception:

Caused by: java.lang.NegativeArraySizeException: -1294959092
    at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
    at org.h2.util.Utils.copyBytes(Utils.java:202)
    at org.h2.store.Data.expand(Data.java:1402)
    at org.h2.store.Data.checkCapacity(Data.java:1395)
    at org.h2.result.RowList.writeRow(RowList.java:76)
    at org.h2.result.RowList.writeAllRows(RowList.java:100)
    at org.h2.result.RowList.add(RowList.java:129)
    at org.h2.command.dml.Delete.update(Delete.java:104)
    at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:45)
    at org.h2.command.CommandContainer.update(CommandContainer.java:173)
    at org.h2.command.Command.executeUpdate(Command.java:250)

I'm not sure if such a large size is supported; if not, I would expect that the size specification is rejected when the table is created. I found this based on commit 073bbb8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions