November 14, 2025
SQL tea is piping hot
RegreSQL: Regression Testing for PostgreSQL Queries
Developers cheer and bicker: a new way to test SQL before it breaks production
TLDR: RegreSQL brings Postgres-style tests to app queries to catch bugs and slowdowns before production. Commenters are excited but clash over tool flexibility, safety on live databases, and whether test data should live in code or config files—questions that matter to anyone shipping features on a database.
RegreSQL just landed like a fire extinguisher for database fires, promising to test your app’s SQL before a late‑night outage. Revived by Radim Marek from Dimitri Fontaine’s original, RegreSQL borrows PostgreSQL’s own regression‑testing playbook to check both correctness and speed, track performance baselines, and flag risky “full table scan” moments. Translation: fewer surprise slowdowns, more predictability.
The comments lit up. WilcoKruijer scolded the industry—“It's pretty terrible how poorly developers test their database queries”—and pressed for flexibility beyond early SQLAlchemy (a popular Python library) hooks. h1fra asked the scary question: can this run safely on a live database? mbvisti brought pure hype: it looks cool. jumski wants to regression‑test SQL functions powering a state machine—proof this isn’t just dashboard fluff but real‑world workflows.
Then the fixture fight broke out. tinodb pushed test data in code, not scattered across config files, quipping “No programming in yaml needed” and “just add a for loop” to scale. The mood is cautious excitement: fans want a safety net for queries; skeptics worry about production risk and tool specificity. If RegreSQL plays nice with your stack and nails performance alerts, expect fewer “AHA” outages—and better sleep.
Key Points
- •RegreSQL applies PostgreSQL’s regression testing methodology to application SQL queries to prevent correctness and performance regressions.
- •It complements compile-time tools (sqlc, PG'OCaml, SQLx) by catching behavior and performance changes not covered by static checks.
- •The tool verifies query outputs against expected results, tracks performance baselines, and flags plan regressions like unexpected sequential scans.
- •The author forked the original project to address missing features and extend capabilities.
- •The article outlines areas such as basic and performance regression testing, ORM considerations, test data management, and the tool’s future direction.