feat: Add pg_partman extension support - #1090
Open
gauthamchandra wants to merge 1 commit into
Open
Conversation
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. Tests come in two layers: a vitest smoke suite in the house style, and a small TAP harness that runs eight of pg_partman's own pgTAP test files verbatim (639 assertions) as the behavioural spec. The vendored files are byte-identical to upstream v5.5.0; the only runtime transformation is stripping psql backslash meta-commands, which have no meaning outside psql. The remaining upstream suites need the background worker, tablespaces, sub-partitioning lock headroom or multi-session commits, and are intentionally out of scope for now. **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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pgTAPand since pglite supportspgTAP, I decided to create 2 sets of tests: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.