Skip to content

Implement pscale shell for Postgres #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 12, 2025
Merged

Implement pscale shell for Postgres #1103

merged 10 commits into from
Aug 12, 2025

Conversation

piki
Copy link
Contributor

@piki piki commented Aug 12, 2025

pscale shell works for Postgres databases now. Unlike Vitess, for Postgres, we just use psql to connect directly to the database, with no local proxy required.

--replica connects to a read-only replica. --role allows reader, writer, readwriter, and admin roles, the same as Vitess.

We always connect to :5432, rather than the pooler on port :6432. We're creating an ephemeral account, and poolers have to give each different account its own connection, so we'd never get pooled. Why pay the extra hop for no benefit?

Screenshot 2025-08-12 at 2 54 22 PM

piki added 10 commits August 12, 2025 11:36
--replica and --role work as expected.  --local-addr is refused because
psql connects directly, not through a local proxy.  --remote-addr is
supported but unlikely to be useful.

We hard-code port :5432 instead of going through the connection pooler on
:6432, because the pooler pools connections by logged-in role.  We're
using an ephemeral role, so we'd always get assigned to our own
connection.  We'd be paying the extra hop through the pooler for no
benefit.
`startShellForPostgres` spawns `psql` synchronously and doesn't need
background threads for a proxy and for password renewals, so we can dump
all the concurrency complexity.
This puts the MySQL code path back almost exactly how it was before the
Postgres changes.  It's logically identical.  Just doing smaller diffs for
easier reviews.
@piki piki requested a review from a team as a code owner August 12, 2025 19:04
@piki piki merged commit 131393b into main Aug 12, 2025
1 check passed
@piki piki deleted the piki/shell-to-postgres branch August 12, 2025 19:21
piki added a commit that referenced this pull request Aug 12, 2025
`pscale shell` was listed as Vitess-specific, but it works with all
databases now.  This change should've been in #1103, but I forgot.

`pscale mcp` was listed as a platform/account command, but it's really a
database management command.  So I'm moving that, too.
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.

2 participants