Back to Skills

pg_dump Reference

Consult PostgreSQL's pg_dump implementation for guidance on system catalog queries and schema extraction when implementing pgschema features

133stars17forksUpdated 3/7/2026

Security Assessment

Safe(100/100)
Security Score100/100

About pg_dump Reference

The pg_dump Reference skill provides guidance on extracting PostgreSQL schema information by consulting the canonical pg_dump implementation. It is designed to help developers accurately query system catalogs and understand how PostgreSQL internally represents database objects. By referencing pg_dump, users can implement or debug pgschema features with confidence, ensuring that schema extraction and object introspection follow PostgreSQL's established patterns and best practices.

This skill includes detailed references to key pg_dump source files, such as `pg_dump.c`, `pg_dump.h`, and `pg_dump_sort.c`, which cover system catalog queries, data structures, dependency sorting, and output formatting. It provides step-by-step workflows for identifying schema objects, locating the relevant pg_dump function, analyzing system catalog queries, and handling special cases like version-specific behavior, default values, and internal objects. Examples include queries for triggers, indexes, tables, functions, views, sequences, types, policies, aggregates, and comments, emphasizing correct handling of PostgreSQL internal functions and dependencies.

The skill is particularly useful for developers working on database introspection, schema migration, or tooling that interacts with PostgreSQL metadata. Target users include software engineers implementing pgschema features, database engineers troubleshooting system catalog queries, and anyone needing to understand PostgreSQL's internal representation of objects across versions 14 to 17. Typical use cases involve adding support for new schema objects, debugging catalog queries, ensuring correct DDL formatting, and managing object dependencies accurately.

FAQ

When should I use the pg_dump Reference skill?

Use this skill when implementing or debugging pgschema features that involve extracting schema information, adding support for new schema objects, or understanding PostgreSQL internal object representations.

Which PostgreSQL versions does this skill cover?

The guidance in this skill is applicable to PostgreSQL versions 14 through 17, with attention to version-specific features and system catalog differences.

Can I rely on information_schema views for triggers or constraints?

No, information_schema views may not provide complete or accurate data for certain features like trigger WHEN clauses. The skill emphasizes using pg_catalog tables and PostgreSQL internal functions instead.

Do I need to know Go to use this skill?

Familiarity with Go is helpful for applying pg_dump patterns in the pgschema codebase, especially when adapting system catalog queries using pgx, but the SQL and PostgreSQL concepts are generally applicable across languages.

Are there limitations when adapting pg_dump queries for pgschema?

Yes, special considerations include handling NULL values, filtering system-generated objects, version-specific differences, dependency tracking, and ensuring safe parameter binding in Go/pgx.

All Files

2 files
metadata.json0.6 KB
View
SKILL.md8.6 KB
View

Install pg_dump Reference

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill