Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0040264 | Openbravo ERP | Y. DBSourceManager | public | 2019-02-25 10:35 | 2019-05-30 04:01 |
|
Reporter | AugustoMauch | |
Assigned To | AugustoMauch | |
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | 3.0PR19Q3 | Fixed in Version | 3.0PR19Q3 | |
Merge Request Status | |
Review Assigned To | caristu |
OBNetwork customer | No |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0040264: update.database task fails with no proper error message when a wrong function is defined in db but not excluded |
Description | There are some functions that are not defined as part of Openbravo model and that they must be excluded from being loaded by adding them to the exclude filter.
Whe one of those functions is not added to the exclude filter, the update.database function will fail, and the error message will not be clear enough:
[java] 67129 INFO - Updating database model...
[java] 67335 ERROR -
[java] 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:529)
[java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.writeDropFunctionStmt(PostgreSqlBuilder.java:346)
[java] at org.apache.ddlutils.platform.SqlBuilder.dropFunction(SqlBuilder.java:4276)
[java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.dropFunction(PostgreSqlBuilder.java:519)
[java] at org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java:1543)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.ddlutils.util.CallbackClosure.execute(CallbackClosure.java:151)
[java] at org.apache.ddlutils.platform.SqlBuilder$1.evaluate(SqlBuilder.java:1024)
[java] at org.apache.commons.collections.CollectionUtils.filter(CollectionUtils.java:406)
[java] at org.apache.ddlutils.platform.SqlBuilder.applyForSelectedChanges(SqlBuilder.java:1021)
Even if the dbsourcemanager log is set to debug, it still does not what was the function that caused the error while being loaded from the database. The cause of the error is that Openbravo does not support to load functions with unnamed parameters. |
Steps To Reproduce | Create this function directly in the database:
CREATE FUNCTION bad_function(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
Run ant update.database -Dforce=yes
The process will fail and it will throw the error mentioned in the description |
Proposed Solution | It would be better to:
- Fail like now, but mentioning in the error message the function that was being loaded and telling that update.database will not work until that function is added to exclude filter / removed from database
- When a function with unnamed parameters is loaded, just ignore and show a warning message. |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2019-02-25 10:35 | AugustoMauch | New Issue | |
2019-02-25 10:35 | AugustoMauch | Assigned To | => platform |
2019-02-25 10:35 | AugustoMauch | OBNetwork customer | => No |
2019-02-25 10:35 | AugustoMauch | Modules | => Core |
2019-02-25 10:35 | AugustoMauch | Triggers an Emergency Pack | => No |
2019-05-09 07:35 | alostale | Target Version | => 3.0PR19Q3 |
2019-05-13 10:55 | AugustoMauch | Assigned To | platform => AugustoMauch |
2019-05-28 11:11 | AugustoMauch | Review Assigned To | => caristu |
2019-05-28 11:12 | hgbot | Checkin | |
2019-05-28 11:12 | hgbot | Note Added: 0112198 | |
2019-05-28 11:12 | hgbot | Status | new => resolved |
2019-05-28 11:12 | hgbot | Resolution | open => fixed |
2019-05-28 11:12 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^] |
2019-05-28 11:14 | hgbot | Checkin | |
2019-05-28 11:14 | hgbot | Note Added: 0112199 | |
2019-05-28 11:14 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^] => http://code.openbravo.com/erp/devel/pi/rev/30d087840b5502ada2a775de7f2c6bf68673883c [^] |
2019-05-28 11:15 | AugustoMauch | Note Added: 0112200 | |
2019-05-28 20:14 | hudsonbot | Checkin | |
2019-05-28 20:14 | hudsonbot | Note Added: 0112215 | |
2019-05-29 13:29 | caristu | Note Added: 0112224 | |
2019-05-29 13:29 | caristu | Status | resolved => new |
2019-05-29 13:29 | caristu | Resolution | fixed => open |
2019-05-29 13:56 | hgbot | Checkin | |
2019-05-29 13:56 | hgbot | Note Added: 0112226 | |
2019-05-29 16:12 | hgbot | Checkin | |
2019-05-29 16:12 | hgbot | Note Added: 0112229 | |
2019-05-29 16:24 | hgbot | Checkin | |
2019-05-29 16:24 | hgbot | Note Added: 0112230 | |
2019-05-29 16:28 | hgbot | Checkin | |
2019-05-29 16:28 | hgbot | Note Added: 0112232 | |
2019-05-29 16:30 | hgbot | Checkin | |
2019-05-29 16:30 | hgbot | Note Added: 0112233 | |
2019-05-29 17:01 | hgbot | Checkin | |
2019-05-29 17:01 | hgbot | Note Added: 0112234 | |
2019-05-29 17:02 | caristu | Status | new => scheduled |
2019-05-29 17:02 | caristu | Status | scheduled => resolved |
2019-05-29 17:02 | caristu | Resolution | open => fixed |
2019-05-29 17:02 | caristu | Note Added: 0112235 | |
2019-05-29 17:02 | caristu | Status | resolved => closed |
2019-05-29 17:02 | caristu | Fixed in Version | => 3.0PR19Q3 |
2019-05-29 20:49 | hudsonbot | Checkin | |
2019-05-29 20:49 | hudsonbot | Note Added: 0112245 | |
2019-05-30 04:01 | hudsonbot | Checkin | |
2019-05-30 04:01 | hudsonbot | Note Added: 0112248 | |
Notes |
|
(0112198)
|
hgbot
|
2019-05-28 11:12
|
|
Repository: erp/devel/dbsm-main
Changeset: fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue May 28 11:05:45 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^]
Fixes issue 40264: Ignore some invalid functions when loading the database model
Openbravo does not support the definition of functions with anonymous parameters. Before this
changeset, loading from the model one of those functions resulted in a NullPointerException.
Now these functions will be ignored when loading the model from the database. This means that
export.database will not export them, and update.database will not overwrite them.
To be able to ignore a row within RowConstructor.getRow a new exception called SkipRowException has
been defined.
---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
M src/org/apache/ddlutils/platform/ModelLoaderBase.java
M src/org/apache/ddlutils/platform/RowConstructor.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
---
|
|
|
(0112199)
|
hgbot
|
2019-05-28 11:14
|
|
Repository: erp/devel/pi
Changeset: 30d087840b5502ada2a775de7f2c6bf68673883c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue May 28 11:13:47 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/30d087840b5502ada2a775de7f2c6bf68673883c [^]
Fixes issue 40264: Ignore some invalid functions when loading the database model
Openbravo does not support the definition of functions with anonymous parameters. Before this
changeset, loading from the model one of those functions resulted in a NullPointerException.
Now these functions will be ignored when loading the model from the database. This means that
export.database will not export them, and update.database will not overwrite them.
To be able to ignore a row within RowConstructor.getRow a new exception called SkipRowException has
been defined.
---
M src-db/database/lib/dbsourcemanager.jar
---
|
|
|
|
There is no need to make changes in OracleModelLoader, because Oracle does not support functions with anonymous parameters.
That's also why the new test added to Functions.java is only executed when using postgres. |
|
|
|
|
|
|
SkipRowException class is missing |
|
|
(0112226)
|
hgbot
|
2019-05-29 13:56
|
|
Repository: erp/devel/dbsm-main
Changeset: f766e3ee8a15c2f7339c4002af68cf6cbc0a0fdb
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 13:55:51 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/f766e3ee8a15c2f7339c4002af68cf6cbc0a0fdb [^]
Related with issue 40264: Adds missing class, renames it to InvalidRowException
---
M src/org/apache/ddlutils/platform/ModelLoaderBase.java
M src/org/apache/ddlutils/platform/RowConstructor.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
A src/org/apache/ddlutils/platform/InvalidRowException.java
---
|
|
|
(0112229)
|
hgbot
|
2019-05-29 16:12
|
|
|
|
(0112230)
|
hgbot
|
2019-05-29 16:24
|
|
|
|
(0112232)
|
hgbot
|
2019-05-29 16:28
|
|
Repository: erp/devel/dbsm-main
Changeset: ff253fd0e2debe8c92ef780dcc6cd690b48e8d58
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 16:28:38 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/ff253fd0e2debe8c92ef780dcc6cd690b48e8d58 [^]
Related with issue 40264: Include function name in warning message
---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
---
|
|
|
(0112233)
|
hgbot
|
2019-05-29 16:30
|
|
|
|
(0112234)
|
hgbot
|
2019-05-29 17:01
|
|
|
|
|
|
|
|
|
|
|
|