Skip to main content

Error: 'Violation of PRIMARY KEY constraint'XPKDM_FIN_DELIVERED_ACTUALS'

In this article, we explain the PRIMARY KEY error in logs caused by duplicate key values in DM_FIN_DELIVERED_ACTUALS.

Y
Written by Yusef Abulaynain

This is a known error which has been fixed and is included in Mosaic RR23.2 release which is officially out now.
​
To upgrade to this version please raise a case after following the instructions on the knowledge article titled Upgrade Requests.

How the error is caused

When a person has a Fairer Charging element (for example), they are charged by the hours that have actually been delivered. These are otherwise known as 'actuals'.
​
These actuals can be entered manually but are more commonly loaded through an interface, such as CM2000/E-invoice/Abacus etc. When the interface runs it will load the actuals data into a table called DELIVERED_ACTUALS. This table has a column ID that serves as the unique index or primary key.

The actuals do not really have an impact until a payment cycle of the type 'einvoice' is ran that covers the period of which that the actual that was entered for.
​
When this happens, the actual is turned into a commitment and payment that is associated with an invoice for that payment cycle.

At that point, the actual then is moved from DELIVERED_ACTUALS to DELIVERED_ACTUALS_APPLIED that also has an ID column. Where the reports come into play is that there is a finance Mosaic datamart table called DM_FIN_DELIVERED_ACTUALS that also has its own primary key called ACTUAL_ID.
​
This combines the actuals from both tables into one. The ACTUAL_ID is made up for the ID from the source table and the element_detail_id.

The issue is that there is a person 1234566 for example that has actuals for different dates that share the same ID in both tables and those actuals also happen to be for the same element_detail_id.

The error occurs as the populate script tries to insert both with the same ACTUAL_ID which is not allowed.

So therefore, the delivered_actuals_applied is using the same id as the delivered_actuals id for the primary key and this causes the constraint error.
​
The upgrade to Mosaic RR 23.2 will resolve this issue.

Did this answer your question?