A "Violation of PRIMARY KEY constraint 'vhist_propval_pk'. Cannot insert duplicate key in object 'dbo.vhist_propval'." Error Occurs When Upgrading From Laserfiche Server 8.3 to Laserfiche 9.0.

February 25, 2013 | KB: 1013171
Laserfiche 9.0

Summary

After upgrading from Laserfiche Server 8.3 to Laserfiche Server 9, you may receive the following error in the Windows Event Log when loading up existing Laserfiche 8.3 repositories.

    Database statement execution error encountered. Session ID: ; Dialog ID: ; Repository: ''; CLI routine: SysLogin; Message: [Microsoft][SQL Native Client][SQL Server]Violation of PRIMARY KEY constraint 'vhist_propval_pk'. Cannot insert duplicate key in object 'dbo.vhist_propval'.; SQL Statement: '

    update vhist_propval
    set prop_id = (select new_id from temp_propdef_map where prop_id = old_id)
    where prop_id in (select old_id from temp_propdef_map)
    '; SQL variable: ''; SQL State: 23000.

Cause

This error can occur in certain repositories when version control is enabled in your Laserfiche 8.3 repository. The upgrade script did not account for certain types of deleted fields.

Resolution

There are updated versions of the affected upgrade scripts for Microsoft SQL Server and Oracle.

  1. Click the following link to download a zip file with the updated scripts.

    KB1013171.zip

  2. Extract the contents of the zip file to the sql subfolder in your Laserfiche Server installation folder. By default, the path is C:\Program Files\Laserfiche\Server\sql
  3. Restart the Laserfiche Server.