pgcov: Bringing Real Test Coverage to PostgreSQL Code
summary
pgcov instruments SQL and PL/pgSQL by injecting pg_notify calls before executable statements, listens for those notifications to map executed byte ranges, and emits JSON/HTML/LCOV reports; it runs as a single binary with run and report commands, requires no extensions required or psql, spawns an isolated temporary DB per test, and targets Postgres 13+. Example demo shows coverage rising from 50% to 70% after adding two test cases; CI-friendly, not a profiler or migration tool.
AI-written summary · about
chapters (13)
- 0:00Music & introduction
- 1:21The PostgreSQL coverage gap explained
- 3:21Current testing approaches & limits
- 5:25Why coverage matters
- 6:48Designing a Postgres coverage tool: pgcov
- 8:54pgcov ooverview & key features
- 9:28How pgcov works under the hood
- 12:54Demo: inventory system example
- 15:02Running pgcov and reading results
- 18:25Improving tests to boost coverage
- 20:18pgcov command options
- 22:05Limitations and future roadmap
- 23:46Final thoughts
related talks
43mWhen it all GOes right
49mWhen it all GOes right
26mTime to Go with PostgreSQL
47mpg_profile: a strategic PostgreSQL monitoring utility
49mProfessional PostgreSQL monitoring made easy
27mQuality Assurance in PostgreSQL
44mDebugging your PL/pgSQL code
22mAccelerating PL/pgSQL Code Conversation When Migrating to Postgres
