Skip to content

User-created objects on extension-owned tables are not included in dump #166

@DobryDobry

Description

@DobryDobry

PGC excludes tables owned by extensions from the dump (via pg_depend deptype = 'e' filter). As a side effect, any objects manually created on those tables are also silently skipped, even though they are not part of the extension itself.

This affects all object types that can be created on a table:

  • Indexes (CREATE INDEX)
  • Triggers (CREATE TRIGGER)
  • Constraints (ALTER TABLE ... ADD CONSTRAINT — CHECK, UNIQUE, FOREIGN KEY)
  • Policies (CREATE POLICY)
  • Rules (CREATE RULE)
  • Statistics (CREATE STATISTICS)

Example

Extension pg_dbms_job owns table dbms_job.all_scheduler_job_run_details

For example, the following index was created manually on this table:

CREATE INDEX idx_log_date ON dbms_job.all_scheduler_job_run_details (log_date);

And this index will not be included in the dump

Root Cause

In src/dump/core.rs, the table query filters out extension-owned tables:

and not exists (
    select 1 from pg_depend ext_dep
    where ext_dep.objid = c.oid
    and ext_dep.deptype = 'e'
)

Since the table is excluded, none of its dependent objects are ever fetched, regardless of whether those objects themselves belong to the extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigationNeed investigation is it possible or not.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions