Skip to content

feat: Add pg_partman extension support - #1090

Open
gauthamchandra wants to merge 1 commit into
electric-sql:mainfrom
gauthamchandra:gauthamchandra/pg_partman
Open

feat: Add pg_partman extension support#1090
gauthamchandra wants to merge 1 commit into
electric-sql:mainfrom
gauthamchandra:gauthamchandra/pg_partman

Conversation

@gauthamchandra

Copy link
Copy Markdown

Summary

Ports pg_partman 5.5.0 to PGlite as @electric-sql/pglite-pg_partman, following the pgmq package as a template.

pg_partman's core is pure PL/pgSQL, so the WASM bundle is the upstream extension built SQL-only (NO_BGW=1, an officially supported upstream build mode): its background worker is just a scheduler that calls run_maintenance_proc(), and background workers cannot exist in single-process WASM. The embedding application decides when to call run_maintenance() instead.

Slight deviation from other packages:

Unlike other packages, I noticed that pg_partman tests their functionality utilizing pgTAP and since pglite supports
pgTAP, I decided to create 2 sets of tests:

  1. Basic smoke tests that runs common pg_partman queries.
  2. A set of pgTAP powered tests that takes the basic functionality promised in pglite for pg_partman and runs the
    original tests that the pg_partman team themselves use. In the event there's something wrong with the backend
    portion of this extension, the pgTAP tests hopefully should catch it. There's even a small script to help pull fresh
    versions of these files directly from upstream so its not a manual process.

@gauthamchandra
gauthamchandra force-pushed the gauthamchandra/pg_partman branch from e15ebd9 to 46e00da Compare August 24, 2026 23:39
Ports pg_partman 5.5.0 to PGlite as @electric-sql/pglite-pg_partman,
following the pgmq package template.

pg_partman's core is pure PL/pgSQL, so the WASM bundle is the upstream
extension built SQL-only (NO_BGW=1, an officially supported upstream
build mode): its background worker is just a scheduler that calls
run_maintenance_proc(), and background workers cannot exist in
single-process WASM. The embedding application decides when to call
run_maintenance() instead.

The vitest suite covers the core lifecycle: extension install, time and
serial (id) partition creation, premake via run_maintenance(), and
retention.

**NOTE**: requires the pg_partman dist rule in postgres-pglite; the
submodule pointer will be bumped here once that backend PR merges.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Gautham Chandra <gautham.chandra@biltcard.com>
@gauthamchandra
gauthamchandra force-pushed the gauthamchandra/pg_partman branch from 46e00da to 0c04660 Compare August 24, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant