Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036862Openbravo ERPA. Platformpublic2017-09-15 08:582017-09-25 13:30
AugustoMauch 
alostale 
normalmajorhave not tried
closedfixed 
5
 
3.0PR17Q4 
AugustoMauch
Core
No
0036862: update.database throws NPE in PostgreSQL 9.6
Update.database fails if executed on an Openbravo instance that uses PostgreSQL 9.6. With the following error:

[java] 20297 INFO - Updating database model...
[java] org.apache.ddlutils.DdlUtilsException: java.lang.NullPointerException
[java] at org.apache.ddlutils.util.CallbackClosure.execute(CallbackClosure.java:154)
[java] at org.apache.ddlutils.platform.SqlBuilder$1.evaluate(SqlBuilder.java:975)
[java] at org.apache.commons.collections.CollectionUtils.filter(CollectionUtils.java:406)
[java] at org.apache.ddlutils.platform.SqlBuilder.applyForSelectedChanges(SqlBuilder.java:972)
[java] at org.apache.ddlutils.platform.SqlBuilder.processChanges(SqlBuilder.java:1060)
[java] at org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java:576)
[java] at org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java:562)
[java] at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformImplBase.java:679)
[java] at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformImplBase.java:662)
[java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.doExecute(AlterDatabaseDataAll.java:178)
[java] at org.openbravo.ddlutils.task.BaseDatabaseTask.execute(BaseDatabaseTask.java:86)
[java] at org.openbravo.ddlutils.task.AlterDatabaseJava.main(AlterDatabaseJava.java:57)
[java] Caused by: java.lang.NullPointerException
[java] at org.apache.ddlutils.model.Parameter.getName(Parameter.java:53)
[java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.writeParameter(PostgreSqlBuilder.java:506)
[java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.writeDropFunctionStmt(PostgreSqlBuilder.java:346)
[java] at org.apache.ddlutils.platform.SqlBuilder.dropFunction(SqlBuilder.java:4224)
[java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBui20485 ERROR -
[java] java.lang.NullPointerException

The functions that are causing the error when trying to be dropped are:
- GIN_TRGM_TRICONSISTENT
- WORD_SIMILARITY
- etc

Those are functions defined by the new version of pg_trgm extension. The excludeFilter needs to be updated to exclude these new functions.
In an Openbravo instance with PostgreSQL 9.6:
- Run update.database. It will fail with a NullPointerException
These are the functions defined by pg_trgm--1.1--1.2 [1] and by pg_trgm--1.3 [2]. Add exclusions for them in the exclude filter.

[1] https://github.com/postgres/postgres/blob/master/contrib/pg_trgm/pg_trgm--1.1--1.2.sql [^]
[2] https://github.com/postgres/postgres/blob/master/contrib/pg_trgm/pg_trgm--1.3.sql [^]
No tags attached.
related to feature request 00346503.0PR17Q2 closed caristu Ability to generate indexes to speed up searching using 'contains' operators 
has duplicate defect 0036043 closed platform update.database fails with NullPointerException when using PostgreSQL 10beta1 
blocks feature request 0036914 closed alostale support PostgreSQL 9.6 
Issue History
2017-09-15 08:58AugustoMauchNew Issue
2017-09-15 08:58AugustoMauchAssigned To => platform
2017-09-15 08:58AugustoMauchModules => Core
2017-09-15 08:58AugustoMauchTriggers an Emergency Pack => No
2017-09-15 09:09AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=15906#r15906
2017-09-15 09:15AugustoMauchSummaryUpgrade excludeFilter in order to support PostgreSQL 9.6 => Upgrade excludeFilter in order to support new versions of the pg_trgm extension
2017-09-15 09:30caristuRelationship addedrelated to 0034650
2017-09-21 12:42caristuRelationship addedrelated to 0036911
2017-09-21 12:42alostaleRelationship addedblocks 0036914
2017-09-21 13:04alostaleRelationship deletedrelated to 0036911
2017-09-21 13:06alostaleReview Assigned To => AugustoMauch
2017-09-21 13:06alostaleTypefeature request => defect
2017-09-21 13:06alostaleSummaryUpgrade excludeFilter in order to support new versions of the pg_trgm extension => update.database throws NPE in PG 6
2017-09-21 13:06alostaleAssigned Toplatform => alostale
2017-09-21 13:12hgbotCheckin
2017-09-21 13:12hgbotNote Added: 0099211
2017-09-21 13:12hgbotStatusnew => resolved
2017-09-21 13:12hgbotResolutionopen => fixed
2017-09-21 13:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/053c21c0408aaec30fec4becace76591c115e2cb [^]
2017-09-21 13:15alostaleRelationship addedhas duplicate 0036043
2017-09-21 13:28hgbotCheckin
2017-09-21 13:28hgbotNote Added: 0099213
2017-09-21 13:32shuehnerSummaryupdate.database throws NPE in PG 6 => update.database throws NPE in PostgreSQL 9.6
2017-09-22 03:19hudsonbotCheckin
2017-09-22 03:19hudsonbotNote Added: 0099450
2017-09-25 13:30AugustoMauchNote Added: 0099544
2017-09-25 13:30AugustoMauchStatusresolved => closed
2017-09-25 13:30AugustoMauchFixed in Version => 3.0PR17Q4

Notes
(0099211)
hgbot   
2017-09-21 13:12   
Repository: erp/devel/pi
Changeset: 053c21c0408aaec30fec4becace76591c115e2cb
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Sep 21 12:49:29 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/053c21c0408aaec30fec4becace76591c115e2cb [^]

fixed bug 36862: update.database throws NPE in PG 6

  It was casued because starting from PG 9.6 a new version of pg_trgm extension
  is used which includes new functions that shouldn't be tried to be processed by
  dbsm.

  Those functions are now excluded.

---
M src-db/database/model/excludeFilter.xml
---
(0099213)
hgbot   
2017-09-21 13:28   
Repository: erp/devel/dbsm-main
Changeset: 03d63d4136e617234506e5091d16229b13c46cdb
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Sep 21 13:09:22 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/03d63d4136e617234506e5091d16229b13c46cdb [^]

related to bug 36862: sync exclude filter for trgm with pi

---
M src-test/model/excludeFilter/excludePgTrgmFunctions.xml
---
(0099450)
hudsonbot   
2017-09-22 03:19   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/79f756868bba [^]
Maturity status: Test
(0099544)
AugustoMauch   
2017-09-25 13:30   
Code reviewed and verified