Error when running analytics

Greetings,
I am using DHIS2.29.
Since last week, the following message is shown when running analytics:
Process failed: StatementCallback; uncategorized SQLException for SQL [drop table if exists analytics_event_gvc2pjecncm;alter table analytics_event_temp_gvc2pjecncm rename to analytics_event_gvc2pjecncm;]; SQL state [2BP01]; error code [0]; ERROR: cannot drop table analytics_event_gvc2pjecncm because other objects depend on it Detail: table analytics_event_2019_gvc2pjecncm depends on table analytics_event_gvc2pjecncm Hint: Use DROP … CASCADE to drop the dependent objects too.; nested exception is org.postgresql.util.PSQLException: ERROR: cannot drop table analytics_event_gvc2pjecncm because other objects depend on it Detail: table analytics_event_2019_gvc2pjecncm depends on table analytics_event_gvc2pjecncm Hint: Use DROP … CASCADE to drop the dependent objects too

I will be thankful if you can provide assistance.
Sincerely
NG

1 Like

Hi @Esumohleb,

this seems to be an issue related to table partitioning which we use for analytics in DHIS2. This seems to be a bug, so I have created a bug issue for it on Jira: https://jira.dhis2.org/browse/DHIS2-7236

In the meantime, I will give you some potential workarounds:

  • Upgrade DHIS2 to a newer version
    This does not seem to be an issue in newer versions of DHIS2, so upgrading should solve your issue.

  • Drop tables causing issues
    Tables with names starting with “analytics_” are generated by running analytics and are safe to drop since they can be recreated. That means you can drop the problematic tables manually using this sql:

  1. (1 table at the time) DROP TABLE <table_name>;
  2. (1 table and all depending tables) DROP TABLE <table_name> CASCADE;

Hope this solves your issue.

1 Like

Greetings,
Thank you for the support.

  1. We did upgrade the platform from 2.29 to 2.30, but the issue was not solved. The event capture was not able to be run, and the event report reported 3 cases over the 1009 entered.

  2. Today, we did drop the tables “analytics_”, then run analytics. The following message appeared: “process failed: exception during execution”. On the other side, the event capture did work, but the even report showed empty tables.

I will be thankful if you can help.
Sincerely
NG

1 Like

Greetings,
We have tried the drop cascade for the tables “analytics_” on testing server but it did not work.
Yesterday, when dropping the tables from the public server, it did work.
Thank you for the instructions.
Sincerely
NG

1 Like

Hi @Esumohleb try to clean the analytics table in Data Administration module before you run analytics.

1 Like