dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38684
Re: Unable to Add Attributes to Program
Hi Tim,
I think the problem here is that the key was not updated properly in your
version.
Table "public.program_attributes"
Column | Type | Modifiers
---------------------------------+---------+-----------
programattributeid | integer | not null
attributeid | integer |
sort_order | integer |
displayinlist | boolean |
programid | integer |
programtrackedentityattributeid | integer | not null
I am pretty sure that the column "programattributeid" has been superceded
by " programtrackedentityattributeid " and should have been handled by an
upgrade script.
Are you (or perhaps me) sure you followed the upgrade procedure properly?
Maybe Abyot can comment on whether this column can be safely deleted.
Regards,
Jason
On Wed, Jul 22, 2015 at 7:57 PM, Timothy Harding <hardingt@xxxxxxxxx> wrote:
> Hello!
>
> I'm seeing an exception when trying to create or edit programs with
> registration attributes.
>
> The system I'm using is running 2.17:
> [image: Inline image 1]
>
> I've created several attributes in the attribute menu:
>
> [image: Inline image 2]
>
> When I go to create a program to utilize these:
>
> [image: Inline image 3]
>
> I get the exception alert:
> [image: Inline image 4]
>
> CATALINA.OUT:
> * INFO 2015-07-22 10:42:29,903 'tharding' create
> org.hisp.dhis.program.Program, name: testprogram, uid: l29CWe5j4LA
> (AuditLogUtil.java [http-bio-8080-exec-2])
> * WARN 2015-07-22 10:42:29,912 SQL Error: 0, SQLState: 23502
> (SqlExceptionHelper.java [http-bio-8080-exec-2])
> * ERROR 2015-07-22 10:42:29,912 ERROR: null value in column
> "programattributeid" violates not-null constraint
> Detail: Failing row contains (null, null, null, t, null, 117704,
> 117700, f, f). (SqlExceptionHelper.java [http-bio-8080-exec-2])
> * ERROR 2015-07-22 10:42:29,913 Error while executing action
> (ExceptionInterceptor.java [http-bio-8080-exec-2])
> org.springframework.dao.DataIntegrityViolationException: could not execute
> statement; SQL [n/a]; constraint [programattributeid]; nested exception is
> org.hibernate.exception.ConstraintViolationException: could not execute
> statement
> (...)
>
> As a result, we now have a program created, but with no attributes. Any
> attempt to add an attribute (via editing the created program) yields the
> same result and same error.
>
> If the above query is referring to the program_attributes table (just a
> guess) it likes it is missing a few FKs (attributeid, programid), and for
> some reason it isn't grabbing a new sequence (programattributeid).
>
> null
>
> programattributeid integer NOT NULL,
>
> null
>
> attributeid integer,
>
> null
>
> sort_order integer,
>
> t
>
> displayinlist boolean,
>
> null
>
> programid integer,
>
> 117704
>
> programtrackedentityattributeid integer NOT NULL,
>
> 117700
>
> trackedentityattributeid integer,
>
> f
>
> mandatory boolean,
>
> f
>
> allowfuturedate boolean,
>
> Please advise, and thanks!
>
>
> Timothy Harding
> RPCV Vanuatu
> Skype: hardingt@xxxxxxxxx
> +1 (541) 632-6623
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
--
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049
Follow ups
References