CMDBuild Forum

Error Updating to 2.3.0

Hello,

I would like to update my version of CMDBuild from 2.0.2 to 2.3.0 running on Debian 6 with Tomcat 6, JDK 1.6 and Postgresql 8.4. To test it first, I've installed new instance of CMDBuild 2.3.0 next to old version and connect it to the copy of the database. Now I see the list of available patches needed to install. However, when I click apply I receive an error. I think the important line is this one from cmdbuild.log:

Caused by: org.postgresql.util.PSQLException: ERROR: relation "_DomainTreeNavigation" already exists

Btw. I've also checked the recommended software and I have found out that you recommend newer Postgresql version. So I've installed Postgresql 9.4 next to the old one and have now the copy of the database in Postgresql 9.4 but still the same result.

Do you know how can I solve this issue?

Thank you.

Dear Martin,
 
could you post the list of already applied patches? You can find it within "Patch" table.
 
Best regards.
 
-- CMDBuild Team
 
Previously Martin wrote:

Hello,

I would like to update my version of CMDBuild from 2.0.2 to 2.3.0 running on Debian 6 with Tomcat 6, JDK 1.6 and Postgresql 8.4. To test it first, I've installed new instance of CMDBuild 2.3.0 next to old version and connect it to the copy of the database. Now I see the list of available patches needed to install. However, when I click apply I receive an error. I think the important line is this one from cmdbuild.log:

Caused by: org.postgresql.util.PSQLException: ERROR: relation "_DomainTreeNavigation" already exists

Btw. I've also checked the recommended software and I have found out that you recommend newer Postgresql version. So I've installed Postgresql 9.4 next to the old one and have now the copy of the database in Postgresql 9.4 but still the same result.

Do you know how can I solve this issue?

Thank you.

 

Here it is: 

  Id   | IdClass |   Code   |                                Description                                 | Status |  User  |         BeginDate          | Notes
-------+---------+----------+----------------------------------------------------------------------------+--------+--------+----------------------------+-------
    12 | "Patch" | 1.3.0-05 | Create database                                                            | A      | system | 2011-05-05 13:27:57.525377 |
  5044 | "Patch" | 1.3.0-06 | Set empty strings to null to reflect the new behavior                      | A      | system | 2011-09-22 10:23:45.754295 |
  5046 | "Patch" | 1.3.1-01 | Update domains mode                                                        | A      | system | 2011-09-22 10:23:46.245201 |
  5048 | "Patch" | 1.3.1-02 | Force Class Id on insert and minor function changes                        | A      | system | 2011-09-22 10:23:46.330336 |
  5050 | "Patch" | 1.3.1-03 | Don't change the relation ID in the history table                          | A      | system | 2011-09-22 10:23:46.333013 |
  5052 | "Patch" | 1.3.1-04 | Set BeginDate on simple classes                                            | A      | system | 2011-09-22 10:23:46.334689 |
  5054 | "Patch" | 1.3.1-05 | Fixes duplicate update when modifying a relation associated to a reference | A      | system | 2011-09-22 10:23:46.336414 |
  9989 | "Patch" | 1.4.0-01 | Reorders tree nodes that were not properly ordered when saving them        | A      | system | 2012-02-17 13:07:07.702893 |
  9991 | "Patch" | 1.4.0-02 | Fixes reference values filling on attribute creation                       | A      | system | 2012-02-17 13:07:07.810357 |
 14367 | "Patch" | 1.5.0-01 | Creates DB templates table                                                 | A      | system | 2012-10-12 12:23:19.44063  |
 14369 | "Patch" | 2.0.0-01 | Dashboard base functions                                                   | A      | system | 2012-10-12 12:23:19.551307 |
 14371 | "Patch" | 2.0.0-02 | Alter workflow tables                                                      | A      | system | 2012-10-12 12:23:19.583928 |
 14373 | "Patch" | 2.0.0-03 | Add UI profile attributes                                                  | A      | system | 2012-10-12 12:23:19.649596 |
 14375 | "Patch" | 2.0.0-04 | A few Dashboard Functions                                                  | A      | system | 2012-10-12 12:23:19.674712 |
 14377 | "Patch" | 2.0.0-05 | Support for INOUT parameters in custom functions                           | A      | system | 2012-10-12 12:23:19.677052 |
(15 rows)
 
Br, Martin
Dear Martin,

"_DomainTreeNavigation" should be created by patch "2.0.3-01", so the next to the situation of your database.

Could you check if that table is empty or not? If yes: make a backup  and drop it using CMDBuild's PostgreSQL function:

    SELECT cm_delete_class('_DomainTreeNavigation');

then restart the application server.

By the way, just in order to understand what's happened to your CMDBuild's instance: did you use a snapshot/developement version, or did you manually execute sql patches on the database?

Best regards.
 
-- CMDBuild Team
 
Previously Martin wrote:
Here it is: 

  Id   | IdClass |   Code   |                                Description                                 | Status |  User  |         BeginDate          | Notes
-------+---------+----------+----------------------------------------------------------------------------+--------+--------+----------------------------+-------
    12 | "Patch" | 1.3.0-05 | Create database                                                            | A      | system | 2011-05-05 13:27:57.525377 |
  5044 | "Patch" | 1.3.0-06 | Set empty strings to null to reflect the new behavior                      | A      | system | 2011-09-22 10:23:45.754295 |
  5046 | "Patch" | 1.3.1-01 | Update domains mode                                                        | A      | system | 2011-09-22 10:23:46.245201 |
  5048 | "Patch" | 1.3.1-02 | Force Class Id on insert and minor function changes                        | A      | system | 2011-09-22 10:23:46.330336 |
  5050 | "Patch" | 1.3.1-03 | Don't change the relation ID in the history table                          | A      | system | 2011-09-22 10:23:46.333013 |
  5052 | "Patch" | 1.3.1-04 | Set BeginDate on simple classes                                            | A      | system | 2011-09-22 10:23:46.334689 |
  5054 | "Patch" | 1.3.1-05 | Fixes duplicate update when modifying a relation associated to a reference | A      | system | 2011-09-22 10:23:46.336414 |
  9989 | "Patch" | 1.4.0-01 | Reorders tree nodes that were not properly ordered when saving them        | A      | system | 2012-02-17 13:07:07.702893 |
  9991 | "Patch" | 1.4.0-02 | Fixes reference values filling on attribute creation                       | A      | system | 2012-02-17 13:07:07.810357 |
 14367 | "Patch" | 1.5.0-01 | Creates DB templates table                                                 | A      | system | 2012-10-12 12:23:19.44063  |
 14369 | "Patch" | 2.0.0-01 | Dashboard base functions                                                   | A      | system | 2012-10-12 12:23:19.551307 |
 14371 | "Patch" | 2.0.0-02 | Alter workflow tables                                                      | A      | system | 2012-10-12 12:23:19.583928 |
 14373 | "Patch" | 2.0.0-03 | Add UI profile attributes                                                  | A      | system | 2012-10-12 12:23:19.649596 |
 14375 | "Patch" | 2.0.0-04 | A few Dashboard Functions                                                  | A      | system | 2012-10-12 12:23:19.674712 |
 14377 | "Patch" | 2.0.0-05 | Support for INOUT parameters in custom functions                           | A      | system | 2012-10-12 12:23:19.677052 |
(15 rows)
 
Br, Martin

 

Hello,
I've done as you asked and now it is clear why the table was there. It was consequence of the first patching attempt. I didn't notice that the error was actually different in the first attempt. Here it is:
 
INFO  2015-03-17 17:06:40 [cmdbuild] Applying patch 2.0.3-01
ERROR 2015-03-17 17:06:40 [jsonrpc ] A org.springframework.jdbc.UncategorizedSQLException occurred calling method class org.cmdbuild.servlets.json.Configure.applyPatches: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [0A000]; error code [0]; Returning autogenerated keys is not supported.; nested exception is org.postgresql.util.PSQLException: Returning autogenerated keys is not supported.
 
So I guess the patching stops somewhere in the middle and thus the another attempt for patching generates different outcome.
What can I do about this error then?
 
Best regards,
Martin Kolovrat
Dear Martin,
 
usually, errors within patches would produce a rollback. So we never had partially-applied patches. We'll investigate this error but in the mean time, if you haven't already do it, remove the wrongly created table and run the Patch Manager again.
 
Best regards.
 
-- CMDBuild Team
 
Previously Martin wrote:
Hello,
I've done as you asked and now it is clear why the table was there. It was consequence of the first patching attempt. I didn't notice that the error was actually different in the first attempt. Here it is:
 
INFO  2015-03-17 17:06:40 [cmdbuild] Applying patch 2.0.3-01
ERROR 2015-03-17 17:06:40 [jsonrpc ] A org.springframework.jdbc.UncategorizedSQLException occurred calling method class org.cmdbuild.servlets.json.Configure.applyPatches: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [0A000]; error code [0]; Returning autogenerated keys is not supported.; nested exception is org.postgresql.util.PSQLException: Returning autogenerated keys is not supported.
 
So I guess the patching stops somewhere in the middle and thus the another attempt for patching generates different outcome.
What can I do about this error then?
 
Best regards,
Martin Kolovrat

 

Hello,
Yes, I've already done it and I received this error again:
 
INFO  2015-03-17 17:06:40 [cmdbuild] Applying patch 2.0.3-01
ERROR 2015-03-17 17:06:40 [jsonrpc ] A org.springframework.jdbc.UncategorizedSQLException occurred calling method class org.cmdbuild.servlets.json.Configure.applyPatches: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [0A000]; error code [0]; Returning autogenerated keys is not supported.; nested exception is org.postgresql.util.PSQLException: Returning autogenerated keys is not supported.
 
And after that, the table "_DomainTreeNavigation" is again there. So the second and any other attempt get me to this error again:
 
Caused by: org.postgresql.util.PSQLException: ERROR: relation "_DomainTreeNavigation" already exists
 
Unless I delete the table again which get me back to first error.
 
Best regards,
Martin Kolovrat