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 usually manifests as an error message related to SQL, indexes, a database procedure, or similar issues.

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. The next step is to repair PostgreSQL — reindex, remove duplicate records, etc. (In isolated cases, this step can be performed on our end as a service intervention. However, the resolution should 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 test restore from the backup.

Possible causes

In isolated cases, a PostgreSQL service outage has occurred at the client's site

  • 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 starting PostgreSQL manually using pg_ctl start and waiting approximately 10–15 minutes for it to start. The default timeout of 300s was not sufficient. The service was subsequently able to start 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.

Error example:

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?