Skip to content

feat(plugins): add PGlite support over the PostgreSQL socket protocol#1934

Merged
datlechin merged 1 commit into
mainfrom
feat/pglite-driver
Jul 21, 2026
Merged

feat(plugins): add PGlite support over the PostgreSQL socket protocol#1934
datlechin merged 1 commit into
mainfrom
feat/pglite-driver

Conversation

@datlechin

Copy link
Copy Markdown
Member

Adds PGlite (https://pglite.dev) as a connection type. PGlite is PostgreSQL 17 compiled to WebAssembly; it speaks the wire protocol only through its socket server (@electric-sql/pglite-socket), so TablePro connects over libpq like PostgreSQL and reuses the same introspection.

Closes #1911.

Shape

PGlite is a variant of the bundled PostgreSQL plugin (the same driverVariant mechanism as Redshift and CockroachDB), curated for PGlite's real constraints: single connection, no TLS, trust auth, loopback host.

Two decisions

Registry fix (root cause). A multi-type plugin has one set of Swift statics, so per-type facts live only in the curated built-in table. registerVariant now keeps that curated entry instead of overwriting it with the shared plugin snapshot. This also fixes a shipped bug where CockroachDB's port (5439 to 5432) and column-edit blocks (false to true) were silently replaced at plugin load. EXPLAIN variants, which curated entries leave empty by convention, still fall back to the plugin, so no variant regresses.

Single connection, honored everywhere. PGlite serves one connection at a time. A new supportsConnectionPooling flag routes PGlite's metadata reads (row counts, structure, autocomplete, sidebar) onto the primary connection instead of opening a second socket, and the libpq driver skips the PQcancel auxiliary connection on cancel, stream teardown, and the row loop. PGlite also drops the .cancelQuery capability and shows an actionable error when the socket server is not running.

Notes

  • No PluginKit/ABI change: the capability is app-side, and the driver's own serial queue already serializes primary and metadata work, so no separate gate was needed.
  • Health monitoring stays on: its 30s ping uses the primary connection, not a new one.
  • Reuses the PostgreSQL icon for now.

Testing

  • New unit tests: PGlite type facts, and a regression test that would have caught the CockroachDB curation drop.
  • swiftlint lint --strict clean on changed files.
  • Manual: run npx @electric-sql/pglite-socket, then connect with host 127.0.0.1, port 5432, database postgres, user postgres.

https://claude.ai/code/session_017Z4znQFPkXHLS6CyVdShx4

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e56234cea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +787 to +788
supportsSSH: false,
supportsSSL: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read PGlite metadata by its variant type

These capability flags are not used by the connection form: PGlite resolves pluginTypeId to PostgreSQL, while the pane checks in PluginManager.supportsSSH(for:) and supportsSSL(for:) read the snapshot using that primary type ID. Consequently PGlite connections still expose the PostgreSQL SSH and SSL panes, and a user can select TLS even though this variant's socket server has no TLS; the selected SSL mode is passed through to libpq and makes the connection fail. The same primary-type lookup also ignores this variant's password-hiding metadata.

Useful? React with 👍 / 👎.

@datlechin
datlechin merged commit 351c5aa into main Jul 21, 2026
1 of 2 checks passed
@datlechin
datlechin deleted the feat/pglite-driver branch July 21, 2026 15:32
@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🔴 Failed Jul 21, 2026, 3:51 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟡 Building Jul 21, 2026, 3:51 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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.

Hope to support PGlite

1 participant