Skip to content
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 support for CopyBoth mode #2923

Open
grim7reaper opened this issue Dec 8, 2023 · 0 comments · May be fixed by #2924
Open

Add support for CopyBoth mode #2923

grim7reaper opened this issue Dec 8, 2023 · 0 comments · May be fixed by #2924
Labels
enhancement New feature or request

Comments

@grim7reaper
Copy link

Is your feature request related to a problem? Please describe.
I'm currently working on a daemon that will consume PostgreSQL replication logs (through logical replication).

Replication in Postgres, be it physical or logical, goes through the CopyBoth "protocol".
Today sqlx only supports CopyIn and CopyOut.

Moreover, to enable replication you need to setup a connection to the server and request the walsender mode, which isn't possible with the current options exposed by PgConnectOptions.

Describe the solution you'd like
Two things:

  • expose the replication mode parameter in PgConnectOptions, to be able to setup a "replication connection".
  • basic support for CopyBoth mode: something that let me receive and send raw bytes is enough (basically what already exists for CopyIn and CopyOut), there is no need for parsing/decoding the Streaming Replication Protocol (I can handle this on my side).

Describe alternatives you've considered

AFAIK, there is no support for replication Postgres libraries in Rust.

There is an open PR from 2015 for tokio-postgres (and a fork by Materialize).
But since the rest of our codebase is using sqlx1 I would rather stay on this stack 😁

Additional context

I already have a working implementation, gonna open a PR and waiting for your feedback/review to hopefully integrate this 🙂


Footnotes

  1. Compile-time checked query is a killer feature, you did a great job!! Can't live without it now! Need the same for ScyllaDB 😅

@grim7reaper grim7reaper added the enhancement New feature or request label Dec 8, 2023
@grim7reaper grim7reaper linked a pull request Dec 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant