← Back to team overview

dhis2-devs team mailing list archive

[Bug 1554482] Re: min-max generated column

 

** Changed in: dhis2
     Assignee: (unassigned) => Lars Helge Øverland (larshelge)

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

Title:
  min-max generated column

Status in DHIS:
  New

Bug description:
  Generation of min/max values fails  (on rev 22150 currently. )
  From the TableAlteror, it looks like this was renamed. 

          executeSql( "update minmaxdataelement set generatedvalue = generated where generatedvalue is null" );
          executeSql( "alter table minmaxdataelement drop column generated" );
          executeSql( "alter table minmaxdataelement alter column generatedvalue set not null" );

  with  the "generated"  column is being dropped.

  Upon running the min/max generation function, one will get

  Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "generatedvalue" violates not-null constraint
    Detail: Failing row contains (568, 66, 443, 15, 180, 120, null, t).
  	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
  	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
  	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
  	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
  	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:405)
  	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:333)
  	at org.amplecode.quick.batchhandler.AbstractBatchHandler.addObject(AbstractBatchHandler.java:179)

  I think the following patch should fix this.

  === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java'
  --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java	2016-01-04 02:27:49 +0000
  +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java	2016-03-08 11:35:56 +0000
  @@ -95,7 +95,7 @@
           statementBuilder.setColumn( "categoryoptioncomboid" );
           statementBuilder.setColumn( "minimumvalue" );
           statementBuilder.setColumn( "maximumvalue" );
  -        statementBuilder.setColumn( "generated" );
  +        statementBuilder.setColumn( "generatedvalue" );
       }

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


References