pg-upgrade-internals

Analyze PostgreSQL pg_upgrade procedures for catalog alignment and file relocation.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/matejformanek/postgres-claude --skill pg-upgrade-internals
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pg-upgrade-internals
Source: https://github.com/matejformanek/postgres-claude/tree/main/.claude/skills/pg-upgrade-internals
Command: npx skills add https://github.com/matejformanek/postgres-claude --skill pg-upgrade-internals

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves the complexity and risks associated with performing in-place major version upgrades for PostgreSQL, preventing data loss and downtime by providing authoritative guidance on catalog alignment and file relocation.

Core Features & Use Cases

  • Upgrade Strategy Analysis: Evaluate the trade-offs between link, copy, and clone methods for data file migration.
  • Failure Diagnosis: Troubleshoot common upgrade blockers like relfilenumber mismatches, extension compatibility, and catalog version conflicts.
  • Use Case: When planning a migration from PostgreSQL 14 to 16, use this skill to audit your current cluster for unsupported extensions or unlogged tables that would cause the upgrade to fail.

Quick Start

Use the pg-upgrade-internals skill to analyze the current data directory and identify potential blockers for a major version upgrade.

Frequently Asked Questions about pg-upgrade-internals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform a PostgreSQL major version upgrade without data loss?

To perform a PostgreSQL major version upgrade safely, you must validate cluster compatibility, audit for unsupported extensions, and resolve catalog version conflicts before executing data file relocation. This requires access to the PostgreSQL source tree and cluster control data.

What is the best way to migrate data files during a PostgreSQL major version upgrade?

The best way to migrate data files during a PostgreSQL upgrade depends on your needs: evaluate the trade-offs between link, copy, and clone methods to balance speed and safety based on your operational requirements.

Why does my PostgreSQL pg_upgrade procedure fail with relfilenumber mismatches?

PostgreSQL pg_upgrade procedures fail with relfilenumber mismatches due to catalog schema extraction and alignment issues. You must validate compatibility using cluster control data and resolve these upgrade-blocking mismatches before retrying.

Do I need access to the PostgreSQL source tree to troubleshoot upgrade blockers?

Yes, you need access to the PostgreSQL source tree and cluster control data to validate compatibility and resolve upgrade-blocking issues like unlogged tables, extension conflicts, and catalog version mismatches during major version migrations.

Can I use pg_upgrade to migrate from PostgreSQL 14 to 16 if I have unsupported extensions?

No, pg_upgrade will fail if unsupported extensions or unlogged tables exist in your current cluster. You must audit your PostgreSQL cluster and resolve all extension compatibility and catalog version conflicts before starting the major version upgrade.

When should I not use the link method for PostgreSQL data file relocation?

You should not use the link method for PostgreSQL data file relocation when your operational requirements prioritize data safety over speed, as evaluating trade-offs between link, copy, and clone methods is essential for preventing downtime.