← Back to team overview

dhis2-devs team mailing list archive

[Bug 510109] Re: Catcombo deletion problems

 

More on this. An exception is actually thrown when attempting to delete
a dataelement category combination

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "categorycombo" violates foreign key constraint "fk4bae70f627f29ff" on table "categorycombos_optioncombos"
  Detail: Key (categorycomboid)=(447770) is still referenced from table "categorycombos_optioncombos".
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
        at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
        ... 114 more

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/510109

Title:
  Catcombo deletion problems

Status in DHIS 2 - District Health Information Software:
  Confirmed

Bug description:
  When deleting categorycombos I've come across a few issues:

  1) When trying to delete a categorycombo that has categoryoptioncombos
  referenced in datavalue an exception is thrown. This should be
  replaced by a more appropriate message saying something like "You
  cannot delete this object as it is referenced by data values". When
  doing the same for categories you get a nice little pop up saying
  something like that, which is needed for catcombos as well.

  2) When trying to delete catcombos "with" data like above the catcombo
  is not deleted (which is good), but before you get the exception the
  reference from all data elements to that catcombo is deleted and
  replaced by the default. This is very confusing and not correct
  behaviour. Would it be possible to to a dry run like process and check
  whether the catcombo can actually be deleted before deleting the data
  element-catcombo associations?

  3) When deleting a catcombo that "has" no data then the catcombo is deleted together with its categoryoptioncombos. But indicator formulas referencing those deleted catoptioncombos are not deleted, so when opening such a formula you get an exception like this:
  Exception (java.lang.IllegalArgumentException): Identifier does not reference a category option combo: 360802 
  Same thing probably goes for validation rules, but haven't checked this yet. I suggest we simply empty the formulas that contain deleted catoptioncombos and leave it up to the user to fill in a new valid formula. No need to delete the indicator itself. The ideal would be to provide the user with a list of indicators and validation rules where formulas have been deleted to make the user aware of the need to updated these.

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/510109/+subscriptions


References