Skip to content

Calling math functions with a string argument results in a NullPointerException #2835

@mrigger

Description

@mrigger

Consider the following statement:

SELECT CEIL('a'); -- NullPointerException

Unexpectedly, the SELECT results in a NullPointerException, which seems to be an internal error:

Caused by: java.lang.NullPointerException
    at org.h2.expression.function.MathFunction.optimize(MathFunction.java:270)
    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 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