feat(plugins): add PGlite support over the PostgreSQL socket protocol#1934
Conversation
There was a problem hiding this comment.
💡 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".
| supportsSSH: false, | ||
| supportsSSL: false, |
There was a problem hiding this comment.
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 👍 / 👎.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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
driverVariantmechanism 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.
registerVariantnow 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
supportsConnectionPoolingflag 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 thePQcancelauxiliary connection on cancel, stream teardown, and the row loop. PGlite also drops the.cancelQuerycapability and shows an actionable error when the socket server is not running.Notes
Testing
swiftlint lint --strictclean on changed files.npx @electric-sql/pglite-socket, then connect with host127.0.0.1, port5432, databasepostgres, userpostgres.https://claude.ai/code/session_017Z4znQFPkXHLS6CyVdShx4