Wieder was gelernt

Restoring PostgreSQL directory backups

2021-08-13 (Friday)
Tags: postgres

PostgreSQL data files are (as we all know) version and platform specific. I tried to recover some data from a backed up /var/lib/postgresql/9.4/main directory. The system was originally a 32 bit Debian 9. I accidentally installed a 64 bit version of Debian 9 and got the error message FATAL: incorrect checksum in control file on startup. After deleting the VM and reinstalling the correct version of Linux (and PostgreSQL from PGDG), I could successfully restore the data directory and restore my data.

PostgreSQL Window Functions

2020-12-18 (Friday)
Tags: postgres sql window functions

A window clause consists of three optional parts, a partition clause, an order clause and a frame clause. The partition clause is similar to a group by clause, except that it can only contain expressions, no output columns. Like the group by clause, it splits the output into parts which are processed independently. The order clause specifies how rows within each partition are ordered. The frame clause finally determines which rows are included in the window.