pg.ddx.io  pgpartman/pg_partman GitHub issues and pull requests  
help / color / mirror / Atom feed
From: Faithfinder (@Faithfinder) <noreply+Faithfinder@github.com>
To: pgpartman/pg_partman <noreply+pgpartman-pg_partman@github.com>
Subject: [pgpartman/pg_partman] issue #860: Feature: p_skip_on_error parameter for run_maintenance_proc()
Date: Thu, 23 Apr 2026 16:50:47 +0000
Message-ID: <gh-pgpartman-pg_partman-860@github.com> (raw)

# Problem

If run_maintenance() raises an unhandled exception for any table, the exception propagates out of the EXECUTE in the loop and aborts the entire procedure. All subsequent tables in the iteration are silently skipped.

A single misconfigured table causes all other partition sets to miss their maintenance window.

# Proposed change
Add p_skip_on_error boolean DEFAULT false to run_maintenance_proc(). When true, wrap each loop iteration in an exception block, emit a WARNING with the table name and error, and continue:

```sql
BEGIN
    EXECUTE v_sql;
    COMMIT;
EXCEPTION WHEN OTHERS THEN
    ROLLBACK;
    RAISE WARNING 'run_maintenance_proc: skipping % due to: % (%)',
        v_row.parent_table, SQLERRM, SQLSTATE;
END;
```

view thread (9+ messages)  latest in thread

Message-ID: <gh-pgpartman-pg_partman-860@github.com>
Permalink:  ../gh-pgpartman-pg_partman-860@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox