PostgreSQL from Rust: Make Related Writes Commit Together
Use bound SQLx queries, database constraints, one transaction for related writes, and a limited pool before adding more service infrastructure.
Start with the database your application already uses, then follow a specific failure. These thirty articles show Rust examples for lost updates, busy writers, retries, schema changes, nullable values and reporting queries.
Use bound SQLx queries, database constraints, one transaction for related writes, and a limited pool before adding more service infrastructure.
Reserve stock with a conditional update, keep the order in the same InnoDB transaction, and check the rollback paths.
Build a small local notes store with rusqlite, a versioned schema, bound values, transactions, and a check that committed data survives reopening.
Use the same Rust checks against MySQL and MariaDB, then keep engine-specific SQL as an explicit capability.
Connect Tiberius with verified TLS, bind one value, and handle a nullable result before moving existing SQL Server work into Rust.
Use the oracle crate with a real Oracle Client, bound values, explicit commits, and a second connection that checks what was saved.
Connect a bounded Rust export tool to Db2 LUW with a real IBM ODBC driver, then check the server version, null values and truncated fields.
Embed DuckDB for a small report, give the CSV an explicit schema, and reject a bad amount instead of silently changing the report.
Coordinate two SQLx connections to compare Read Committed and Repeatable Read, then choose the snapshot boundary a request actually needs.
Force a serialization conflict with two SQLx connections and check that a bounded retry opens a new transaction and repeats the reads that chose the write.
Compare non-indexed and indexed updates using PostgreSQL's current-transaction HOT counters, without turning a tiny fixture into a performance claim.
Omit a tenant filter deliberately, test through a non-owner PostgreSQL login, and keep transaction-local tenant context from leaking through a SQLx pool.
Disconnect a SQLx listener, create work while it is absent, and recover from a durable table after listening again. Notifications remain a wake-up signal.
Keep an old Rust decoder unchanged while adding a PostgreSQL enum value, and separate committing the schema change from allowing writers to use it.
Inspect a secondary-index query with numeric and text primary keys, and see why the key choice affects more than one index.
Coordinate two transactions to create a real lock cycle, then retry whole transactions with a limit and use a consistent row order.
Hold an indexed locking read open and compare an insert under REPEATABLE READ and READ COMMITTED.
Reproduce a unique-key collision caused by collation and separate display text from the rules for identity.
Use two rusqlite connections to distinguish writer contention from a stale read snapshot, then choose a bounded wait or restart the transaction.
Give one thread a SQLite connection, limit its request queue, and check that Tokio can run another task while a submitted write remains pending.
A valid Rust project ID can still reference a missing row. Check foreign-key enforcement when opening each connection and exercise real deletion rules.
Send raw JSON with duplicate keys to both engines and check storage, extraction, missing fields and explicit null.
Use a system-versioned table to read values after update and deletion, while keeping business time, access and backups explicit.
Reproduce a blocked SQL Server read from Rust, check READ_COMMITTED_SNAPSHOT and distinguish lock timeout 1222 from an application timeout.
Capture actual SQL Server plans from Rust with bound parameters, then separate parameter-sensitive behavior from a slow query that only looks identical.
Use Tiberius bulk copy with checked constraints and explicit transactions, then verify rollback, committed rows and rejected data separately.
Bind empty, null, space-only, and populated VARCHAR2 values to see which distinctions an Oracle-backed Rust form can preserve.
Check Oracle NUMBER conversion at the i64 boundary and retain large integral values exactly without an f64 detour.
Generate a multi-row-group Parquet file, query a narrow range from Rust, and separate a pushed-down filter from measured I/O savings.
Run a bounded Rust sorting query with explicit memory and scratch budgets, and report observed spill instead of assuming it.