No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-15 10:52:41 +00:00
AGENTS.md repo: document and license project 2026-09-15 10:52:41 +00:00
COPYING repo: document and license project 2026-09-15 10:52:41 +00:00
flake.lock repo: extract collation module 2026-09-15 10:52:41 +00:00
flake.nix repo: document and license project 2026-09-15 10:52:41 +00:00
module.nix repo: document and license project 2026-09-15 10:52:41 +00:00
README.md repo: document and license project 2026-09-15 10:52:41 +00:00

PostgreSQL collation repair

A NixOS module that detects collation-version drift after PostgreSQL package or system collation-library upgrades, then refreshes the recorded PostgreSQL collation versions. It exports nixosModules.default.

PostgreSQL records and compares per-database collation versions starting with PostgreSQL 15. On earlier releases the service exits without making changes, because that tracking is unavailable.

Warning

By default, drifted databases are reindexed before their collation version is refreshed. REINDEX DATABASE can take substantial time and acquire locks that block database activity. Plan maintenance windows and backups accordingly. Disabling reindexing only clears PostgreSQL's mismatch warning; indexes retain the old sort order and may be incorrect unless rebuilt separately.

Use

Add the flake as an input and import its NixOS module:

{
  inputs.postgresql-collation.url = "...";

  outputs = { postgresql-collation, ... }: {
    nixosConfigurations.host = nixpkgs.lib.nixosSystem {
      modules = [ postgresql-collation.nixosModules.default ];
    };
  };
}

The repair service is enabled automatically whenever services.postgresql.enable is enabled, and reindexes before refreshing versions:

{
  services.postgresql.enable = true;
}

To keep the service enabled but refresh versions without reindexing, explicitly accept the operational risk and configure:

{
  services.postgresql = {
    enable = true;
    collationRepair.reindex = false;
  };
}

To disable the service entirely, set services.postgresql.collationRepair.enable = false.

License

Copyright 2026 Alexander Khodyrev. Licensed under the GNU Affero General Public License, version 3 or later. See COPYING.