V2.27 Ability to delete tracked entity attribute

We set up a tracked entity attribute initially. Now wish to remove this.

From a logical perspective we have removed all data input associated with this tracked entity attribute, removed the attribute association with the program and tried to delete it.

We get the following error Error_TrackedEntityAttribute_220219

How do we delete this tracked entity attribute?

Thanks in advance for your feedback.



You haven’t included the full error message - there’s a name after the words “on table …”.

The missing table name is “trackedentityattributevalueaudit”, though (can be derived from the constraint name that you DID include). And that’s the crux of the matter: due to that constraint, you will not be able to delete any attribute that still have records in the trackedentityattributevalueaudit table.

The trackedentityattributevalueaudit works like a sort of “backup” - when you delete records via the UI in the “main” trackedentityattributevalue table, those records are first copied to the trackedentityattributevalueaudit table and then deleted from the trackedentityattributevalue table.

Regrettably, there’s no simple way to get rid of those “backup” records - you have to do it in the back end / API (you cannot do it via SQL View either, since keywords like “DELETE” are blocked)

Best regards


Hi @MCunningham,

I hope you are well. Were you able to delete the tracked entity attribute as per @Calle_Hedberg’s recommendation?


1 Like