You encounter a PSQLException during a ConnectAll upgrade. The error indicates a duplicate key value violates the unique constraint properties_pkey because a specific ID already exists. This happens when the PostgreSQL ID sequence for the properties table returns a value lower than the actual maximum ID present in the table
The properties_id_seq sequence is out of sync with the data in the properties table. When the installer attempts to insert new records, the sequence generates an ID that is already in use, leading to a constraint violation
To resolve this issue and synchronize the sequence with your table data, perform the following steps:
Before performing upgrades in other environments (such as Production or UAT), you should verify the sequence health by running these queries:
SELECT MAX(id) FROM properties;SELECT last_value FROM properties_id_seq;Ensure that the last_value from the sequence is greater than or equal to the MAX(id) from the table. If it is lower, apply the fix in step 2 of the Resolution section before starting the upgrade