Description
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 inPgConnectOptions
, 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 forCopyIn
andCopyOut
), 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 sqlx
1 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
-
Compile-time checked query is a killer feature, you did a great job!! Can't live without it now! Need the same for ScyllaDB 😅 ↩