| Crates.io | postgres_sync |
| lib.rs | postgres_sync |
| version | 0.1.2 |
| created_at | 2025-06-09 21:49:59.00456+00 |
| updated_at | 2025-09-16 13:25:51.789948+00 |
| description | A synchronous PostgreSQL client using std::net, with an API compatible with the popular postgres crate. |
| homepage | |
| repository | https://github.com/Vlad-Shcherbina/postgres_sync |
| max_upload_size | |
| id | 1706424 |
| size | 47,356 |
A purely synchronous PostgreSQL client library that provides the same interface as the postgres crate,
but uses standard library networking instead of tokio.
This results in a smaller dependency graph and more predictable blocking behavior.
The original postgres crate was synchronous until version 0.15.2.
After that, it became a thin wrapper around the async tokio-postgres crate.
This project revives the purely synchronous approach for applications where async is not a requirement.
postgres_sync✅ Use this library when:
tokio❌ Don't use this library when:
tokiopostgres crateReplace your postgres dependency in Cargo.toml:
# before
[dependencies]
postgres = { version = "...", features = ["with-serde_json-1"] }
# after
[dependencies]
postgres = { package = "postgres_sync", version = "0.1", features = ["with-serde_json-1"] }
That's it! It's designed as a drop-in replacement.
postgres_sync implements a subset of the postgres crate's API.
The goal is for any implemented feature to behave identically to the original.
Config::parse() with connection strings of the form "postgresql://user:password@host:port/db"Client::connect(), Config::connect() with NoTlsClient::transaction(){Client, Transaction}::query_raw(){Client, Transaction}::query_one(){Client, Transaction}::query(){Client, Transaction}::batch_execute(){Client, Transaction}::execute()with-serde_json-1 feature flagwith-chrono-0_4 feature flagpostgres_sync is not a 1:1 clone of the postgres API.
It aims for compatibility where implemented, but provides a partial and evolving implementation.
This means you may encounter differences in the following ways:
postgres counterpart.
For example, Client::connect() supports connection strings but does not yet handle TLS configuration options.postgres crate.postgres_sync - The main library crateverify_* - Binary test crates that run the same test suite against a live PostgreSQL instance.
verify_orig links against the original postgres crate.verify_sync links against this crate (postgres_sync).verify_sync/src -> verify_orig/src) to guarantee the tests are identical.This project is licensed under the same terms as the postgres crate:
Choose whichever license works best for your use case.
postgres_sync is inspired by and heavily dependent on the excellent rust-postgres collection of crates by Steven Fackler.
It specifically uses the postgres-protocol and postgres-types crates for handling low-level details.