-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add PostgreSQL REPL implementation #49598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass. Overall logic looks good to me.
A few things i wonder if we could do (not immediately but maybe after MVP):
- common REPL so it can be used for other protocols like MySQL
- test postgres repl (or even do this through the webapi websocket) in E2E test (or testcontainers) against real RDS/Postgres
switch { | ||
case strings.HasPrefix(line, commandPrefix) && !readingMultiline: | ||
var exit bool | ||
reply, exit = r.processCommand(line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write non-empty reply before exit?
We could do this in the future (when we introduce another database). However, it is a bit difficult to identify which part we can reuse right now.
I'll add the integration and E2E tests after we have both parts (web handler and REPL) ready/merged. So we can thoroughly test their usage against the databases. |
Part of #44956 (RFD 0181)
This PR introduces the PostgreSQL REPL implementation following the RFD definition, which will be used as a client to access PostgreSQL instances through WebUI. It works like a terminal emulator (implemented by
golang.org/x/term
library) and will be used with the WebUI terminal (like WebUI SSH sessions).Note
This PR only includes the REPL implementation. The web handlers and WebUI changes will be done in different PRs.
For this first release of the REPL, we're not including informational commands (such as
\d
or\dt
). These commands will require better testing across different PostgreSQL versions and will be introduced in later versions.