Skip navigation

pgcov: Bringing Real Test Coverage to PostgreSQL Code

Pavlo Golub

Pavlo Golub Pavlo Golub

(Livestream 3)

We rely heavily on PostgreSQL functions, procedures, and SQL logic, yet we largely test them as black boxes. Tests may pass, but we rarely know what actually executed and what code paths remain untested.

pgcov proposes a missing piece in the PostgreSQL tooling ecosystem: coverage analysis for SQL and PL/pgSQL, similar to what go test -cover or pytest --cov provides for application code.

The idea is simple:

  • treat SQL as first-class source code,
  • run isolated tests against it,
  • instrument execution at the SQL/PLpgSQL level,
  • and produce actionable coverage reports.

pgcov does not require PostgreSQL extensions, does not depend on psql, and is designed to integrate naturally into CI/CD pipelines. It complements existing testing tools like pgTAP by answering a different question:

“Which parts of our database code are actually tested?”

This talk explores the motivation, design approach, and how pgcov can significantly improve confidence in database-centric systems without changing how we write PostgreSQL code today.

talk bubbles
Join the conversation

Use the hashtag #PosetteConf