Skip to content

Commit aba6409

Browse files
noahgiftclaude
andcommitted
feat: initial Postgres From Zero companion repo
Companion to the Coursera course "Postgres From Zero", sibling to paiml/mysql-from-zero and paiml/duckdb-from-zero. A single `git clone && make demo` away from running every example shown in the videos plus the Rust capstone foundation. Layout: - sql/01-fundamentals + sql/02-joins: 8 SQL examples covering connect, list tables, modify, export, join traversal, INNER vs LEFT, and EXPLAIN (ANALYZE, BUFFERS). - sql/pagila-analytics: the queries the Rust capstone runs. - crates/postgres-reports: sqlx::PgPool + clap CLI with 13 named provable contracts asserted at runtime; lib + bin split so the capstone reading can extend the lib API directly. - scripts/load-pagila.sh: idempotent Pagila loader (Sakila port for Postgres). scripts/verify.sh asserts all four headline counts. - docker-compose.yml: postgres:16 with persistent pgdata volume. Provable contracts (contracts/postgres-reports.yaml is the manifest): customers-row-count, customers-top-nonzero, customers-monotonic, customers-row-shape, films-row-count, films-top-nonzero, films-monotonic, films-row-shape, actors-row-count, actors-top-nonzero, actors-monotonic, actors-row-shape, run-output. Each is asserted at runtime, prints `contract: <name> OK` to stderr on success, and has a per-contract unit test (positive + #[should_panic] negative). Quality status: - 45 tests passing (27 unit + 7 binary smoke + 6 integration + 5 doctest) - 100% line coverage / 100% function coverage (cargo llvm-cov gate) - cargo clippy --all-targets -- -D warnings clean (workspace lints in Cargo.toml + .clippy.toml in effect) - pmat quality-gate: 1 violation (entropy false-positive on small repos, matches duckdb-from-zero baseline) - Criterion bench for assertion overhead (~7 ns/row, linear scaling) Compliance scaffold: LICENSE (MIT), CHANGELOG.md, deny.toml, .clippy.toml, .cargo/config.toml, [workspace.lints.{rust,clippy}], release profile (lto = "thin", codegen-units = 1, strip = "symbols"). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 parents  commit aba6409

35 files changed

Lines changed: 3694 additions & 0 deletions

.cargo/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build]
2+
# Match the sibling companion repos for reproducible builds.
3+
4+
[net]
5+
retry = 3
6+
git-fetch-with-cli = true
7+
8+
[term]
9+
verbose = false

.clippy.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
disallowed-methods = [
2+
{ path = "std::env::set_var", reason = "process-global state breaks parallel tests" },
3+
]

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DATABASE_URL=postgres://postgres:postgres@localhost:5432/pagila

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/target/
2+
.env
3+
/data/
4+
*.dump
5+
.DS_Store
6+
7+
# Local pmat / pv tooling state
8+
/.pmat/
9+
/.pmat-metrics/
10+
/.pv/

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Changelog
2+
3+
All notable changes to this companion repo are recorded here. The format
4+
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the repo
5+
follows [Semantic Versioning](https://semver.org/) for the Rust crate
6+
(`postgres-reports`); the SQL examples and Makefile entry points are
7+
versioned together as a single repo.
8+
9+
## [Unreleased]
10+
11+
### Added
12+
- `make verify` headline-count smoke test (film/actor/rental/language)
13+
- `make demo` SQL walkthrough across `sql/01-fundamentals/` and `sql/02-joins/`
14+
- `make capstone` entry point that runs `postgres-reports` against Pagila
15+
- `make coverage` cargo-llvm-cov gate with a 100% line floor
16+
- `crates/postgres-reports/` with `sqlx::PgPool`, clap CLI, and 13 named
17+
provable contracts asserted at runtime
18+
- `contracts/postgres-reports.yaml` machine-readable contract index
19+
- `docker-compose.yml` for `postgres:16` with a persistent `pgdata` volume
20+
- `scripts/load-pagila.sh` idempotent loader
21+
22+
## [0.1.0] - 2026-05-05
23+
24+
Initial public release. Companion repo for the Coursera course
25+
**Postgres From Zero**, sibling to `paiml/mysql-from-zero` and
26+
`paiml/duckdb-from-zero`.

0 commit comments

Comments
 (0)