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

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

Conversation

@gauthamchandra

@gauthamchandra gauthamchandra commented Aug 18, 2026 •

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.

Testing

A vitest suite in packages/pglite-pg_partman/tests/pg_partman.test.ts covers the core lifecycle: extension install, time and serial (id) partition creation, premake via run_maintenance(), and retention.

The earlier pgTAP layer, which ran upstream's own test files, has been removed per review feedback as overkill for the in-tree suite.

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

@gauthamchandra
gauthamchandra force-pushed the gauthamchandra/pg_partman branch 2 times, most recently from 46e00da to 0c04660 Compare August 24, 2026 23:41
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 0c04660 to 5e4917b Compare September 23, 2026 15:14

This branch has not been deployed

No deployments
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