While SQLite is fine for prototyping and simpler use cases, a real relational database management system can make the life of a developer much easier. One such sophisticated database system is PostgreSQL. To integrate postgres in Rust, we have the postgres crate on crates.io. It's a native Rust client, meaning that it does not ride on a C library but implements the whole protocol in Rust. If the API looks familiar to the rusqlite crate, this is deliberate; the SQLite client's API is actually based on the postgres client.The postgres crate supports some of PostgreSQL's unique features, such as bit vectors, time fields, JSON support, and UUIDs.
In this section, we'll explore interacting with postgres by creating a sample program that initializes the postgres database and does a few inserts and queries on the database. We assume that you have already...