Hi all,

I just upgraded H2 from 1.4.197 to 1.4.200 and we are now hitting a NPE. I
narrowed down the case and it seems to be related to executing multiple
statements in 1, with a specific sequence. Out of curiosity I tried 1.4.198
and 1.4.199 and the bug also occurs there.

The statement (to be executed in a single statement):
CREATE TABLE TblA (AField DOUBLE);
CREATE INDEX TblAIndex ON TblA(AField);
ALTER TABLE TblA ADD (PrevDate DOUBLE);
CREATE TABLE TblB(AField DOUBLE) AS SELECT AField FROM TblA;

The NPE (MV_STORE FALSE):
Caused by: java.lang.NullPointerException
at
com.h2database/org.h2.pagestore.db.PageStoreTable.getRowCountApproximation(PageStoreTable.java:510)
at com.h2database/org.h2.pagestore.db.ScanIndex.getCost(ScanIndex.java:122)
at
com.h2database/org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:234)
at com.h2database/org.h2.table.Plan.calculateCost(Plan.java:120)
at com.h2database/org.h2.command.dml.Optimizer.testPlan(Optimizer.java:181)

The NPE (MV_STORE TRUE):
Caused by: java.lang.NullPointerException
at com.h2database/org.h2.mvstore.db.MVTable.lock(MVTable.java:132)
at com.h2database/org.h2.table.TableFilter.lock(TableFilter.java:207)
at
com.h2database/org.h2.command.dml.Select.queryWithoutCache(Select.java:819)
at
com.h2database/org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:201)
at com.h2database/org.h2.command.dml.Query.query(Query.java:489)
at com.h2database/org.h2.command.dml.Insert.insertRows(Insert.java:217)
at com.h2database/org.h2.command.dml.Insert.update(Insert.java:151)
at
com.h2database/org.h2.command.ddl.CreateTable.update(CreateTable.java:145)

Are we doing something wrong?

I add our minimal test case as an attachment, you can simply run it. You
can also easily switch between the 2 stores too.

Thanks a lot for the amazing work!
-Christopher

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CADFnS4RXC6-DHYsTCofwVfu6BbPwNnpBhDxfhZTDKsSahP%2Bwdg%40mail.gmail.com.

Attachment: H2NpeTest.java
Description: Binary data

Reply via email to