Skip to content

INSERT() with NULL arguments for the original string and string to be added results in NPE #2838

@mrigger

Description

@mrigger

Consider the following statement:

SELECT INSERT(NULL, 0, 0, NULL); -- NullPointerException

Unexpectedly, the SELECT results in a NullPointerException:

Caused by: java.lang.NullPointerException
    at org.h2.value.ValueVarchar.get(ValueVarchar.java:55)
    at org.h2.expression.function.StringFunction.getValue(StringFunction.java:120)
    at org.h2.expression.function.StringFunction.optimize(StringFunction.java:263)
    at org.h2.command.query.Select.prepare(Select.java:1170)
    at org.h2.command.Parser.prepareCommand(Parser.java:951)
    at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:618)
    at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:556)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1139)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:221)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:207)

I found this based on commit 2b77de6

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