Commit aba6409
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
File tree
- .cargo
- contracts
- crates/postgres-reports
- benches
- src
- tests
- scripts
- sql
- 01-fundamentals
- 02-joins
- pagila-analytics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments