Skip to main content

Issues with PostgreSQL Database in Flexi

Flexi application displays a PostgreSQL database error

Written by Petr Pech

In some cases, a database error may occur. In the application, such an error typically manifests as an error message related to SQL, indexes, a database procedure, or similar.

Troubleshooting procedure

  1. An important step before making any changes to the database is to back up your data. We recommend backing up regularly (own/local server; for cloud, we handle backups on our side), and ideally keeping older backups available as well.

  2. We recommend creating a backup copy of the entire PostgreSQL data directory.

  3. Perform a disk integrity check (check disk, fsck, ...)

  4. Next, repair PostgreSQL — reindex, remove duplicate records, etc. (In exceptional cases, this step can be performed on our end as a service intervention. However, the resolution should ideally be carried out by your database specialist.)

  5. The final step is to verify functionality by creating a current backup of the billed company in Flexi and performing a verification restore from backup.

Possible causes

In isolated cases, a PostgreSQL service outage has occurred on the client side

  • Windows Server 2022 Standard

  • The log displays a general message: "WinStrom-PostgreSQL was unexpectedly terminated."

  • A standard service restart (server and PostgreSQL) did not resolve the issue.

Ultimately, the issue was resolved by manually starting PostgreSQL using pg_ctl start and waiting approximately 10–15 minutes for the startup to complete. The default timeout of 300s was not sufficient. The service was subsequently started successfully.

ERROR: could not create unique index

The issue is caused by a change in local storage following an OS update — PostgreSQL currently has no way to detect an incompatible glibc update (source). As a resolution, it is usually sufficient to clear the wcolumn table.

Example error:

ERROR: could not create unique index "ddoklint_kod_key" Detail: Key (kod, modul)=(PE+0001/2021, POK) is duplicated.: updateDatabaseInternal

Did this answer your question?