encore-postgres-protocol 2.0.0-beta.20

Low level Postgres protocol APIs
Documentation
# Encore PostgreSQL fork

This directory contains Encore's rust-postgres fork, imported from
`encoredev/rust-postgres` branch `encore-crates-io`, based on
`encore-patches-sync` commit `9b5966f4b6baba9e67422002f4540a99fb2af1da`,
including the package renames from that checkout.
Upstream authorship and MIT/Apache-2.0 licensing are preserved; see
`LICENSE-MIT`, `LICENSE-APACHE`, and `THIRD_PARTY`.

All packages are members of the repository's root Cargo workspace. There is no
separate nested workspace or lockfile. Upstream development packages, tests,
and database fixtures are retained; upstream CI and repository tooling are not.
`README.md` is the original upstream documentation.

The workspace aliases these local packages for Encore consumers:

- `postgres-protocol`: `encore-postgres-protocol`
- `tokio-postgres`: `encore-tokio-postgres`
- `postgres-native-tls`: `encore-postgres-native-tls`

The Rust library names remain unchanged. Consumers use `workspace = true`;
no PostgreSQL Git patches or sibling checkout are needed. The driver uses
crates.io `postgres-types` so integrations such as pgvector share its
`ToSql`/`FromSql` traits. The retained local `postgres-types` and other upstream
development packages are not used by the SDK.

## Changes made in this repository

- `tokio-postgres`: `Connection::driven_by` (`src/driven.rs`) shares a
  connection between the task that runs it and its client, whose calls then
  write their own requests on their own threads instead of waking that task
  for each. The SDK core's pools use it.

## Development

The default workspace members preserve the repository's normal build/test
scope. Select the fork packages explicitly when working on them:

```sh
cargo check -p encore-postgres-protocol -p encore-tokio-postgres -p encore-postgres-native-tls --all-features
cargo test -p encore-postgres-protocol
```

Driver and TLS integration tests require PostgreSQL on port 5433 with the
roles and extensions in `docker/sql_setup.sh`. `docker-compose.yml` provides
that fixture. The inherited TLS certificate expired in June 2026; refresh it
in both the setup script and `test/server.crt` / `test/server.der` before TLS
tests. Tests do not start a database automatically.

Once the database fixtures are ready, run from the repository root:

```sh
cargo test -p encore-postgres-protocol -p encore-tokio-postgres -p encore-postgres-native-tls --all-features --lib --tests
```

Publishing automation is intentionally deferred to the coordinated Rust SDK
release work.