Filtering Objects
Filter which objects are compared and migrated using name patterns and object types.
Filter by name pattern
Section titled “Filter by name pattern”# Include only objects matching patternspgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --include 'api_*' --include 'users'
# Exclude objects matching patternspgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --exclude '_*' --exclude 'pg_*'Filter by object type
Section titled “Filter by object type”# Only compare tables and functionspgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --include-types tables,functions
# Exclude extensions from comparisonpgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --exclude-types extensionsCombine filters
Section titled “Combine filters”# Compare only functions matching 'api_*', excluding internal onespgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --include-types functions \ --include 'api_*' \ --exclude '_*'Filter nested types within tables
Section titled “Filter nested types within tables”# Compare tables without RLS policiespgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --exclude-types policies
# Compare only table structure (no indexes, constraints, or policies)pgmold plan -s sql:schema.sql -d postgres://localhost/mydb \ --exclude-types policies,indexes,foreignkeys,checkconstraintsAvailable object types
Section titled “Available object types”Top-level: extensions, tables, enums, domains, functions, views, triggers, sequences, partitions
Nested (within tables): policies, indexes, foreignkeys, checkconstraints
Extension objects
Section titled “Extension objects”By default, pgmold excludes objects owned by extensions (e.g., PostGIS functions, pg_trgm operators) from diffs.
# Include extension objects if neededpgmold dump -d postgres://localhost/mydb --include-extension-objects -o full_schema.sql