Skip to content

feat(destination-postgres): add PGlite support#364

Draft
tonyxiao wants to merge 5 commits intodevfrom
pglite
Draft

feat(destination-postgres): add PGlite support#364
tonyxiao wants to merge 5 commits intodevfrom
pglite

Conversation

@tonyxiao
Copy link
Copy Markdown
Collaborator

@tonyxiao tonyxiao commented May 6, 2026

Summary

  • Refactor destination-postgres to support both pg.Pool and PGlite as backends
  • PGlite enables in-process WASM Postgres — useful for testing without Docker and lightweight embedded deployments
  • Add QueryClient/ManagedClient abstractions (src/client.ts) so writeMany/upsertMany/deleteMany accept either backend
  • Add pglite config option: true for in-memory, { data_dir: "..." } for persistent storage
  • Add @electric-sql/pglite as optional peer dependency (same pattern as AWS SDK)
  • Add PGlite-specific test suite (8 tests, no Docker required)

Test plan

  • All existing tests pass (except pre-existing flaky timing test)
  • New PGlite test suite passes: check, setup, write, upsert, delete
  • TypeScript compiles cleanly
  • Build succeeds
  • OpenAPI specs regenerated

🤖 Generated with Claude Code

tonyxiao and others added 5 commits May 6, 2026 15:45
Refactor destination-postgres to support both pg.Pool and PGlite as
backends. PGlite enables in-process WASM Postgres for testing without
Docker and lightweight embedded deployments.

- Add QueryClient/ManagedClient abstractions (src/client.ts)
- Add `pglite` config option (true for in-memory, {data_dir} for persistent)
- Refactor writeMany/upsertMany/deleteMany to accept QueryClient interface
- Add @electric-sql/pglite as optional peer dependency
- Add PGlite-specific test suite (no Docker required)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
…rt, upgrade to pglite 0.4.5

- Add `allow_experimental_pglite` boolean config gate
- Detect file:// and memory:// URL schemes and route to PGlite
- Upgrade @electric-sql/pglite from 0.2.17 to 0.4.5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
PGlite's query() rejects multiple SQL statements in a single call.
Fall back to exec() when the "multiple commands" error is detected.
This fixes destination setup which uses buildCreateTableDDL (returns
a DO block + standalone DO blocks).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
@tonyxiao tonyxiao changed the base branch from main to dev May 7, 2026 06:38
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