3 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
RegreSQL automates regression testing for SQL queries in PostgreSQL. It runs your SQL files, compares the output to expected results, and alerts you to any changes. The tool supports snapshot management and allows for configuration of test parameters.
If you do, here's more
RegreSQL is a tool designed for regression testing of SQL queries in PostgreSQL. It automates the process of capturing expected results from SQL files and comparing them against current outputs to catch any unexpected changes. The setup involves using Homebrew or Go for installation, and it requires PostgreSQL client tools. Key commands include initializing a project with `regresql init`, discovering SQL files with `regresql discover`, and adding queries to the test suite using `regresql add`.
The testing process is straightforward. Users can capture the expected output with the `regresql update` command and run tests using `regresql test`. The tool supports multiple output formats, including JUnit and JSON, and allows for detailed control over individual queries. It can also create EXPLAIN cost baselines to monitor query performance changes over time. For managing database states, RegreSQL offers snapshot functionality, enabling users to build and restore database states for reproducible tests.
RegreSQL supports named and positional parameters in queries and can handle multiple queries within a single SQL file. Configuration options allow users to ignore certain files or control test behavior. The tool also integrates with fixturize for consistent data handling and migration testing, enabling users to assess how changes affect query outputs. The structure of the project includes several directories for configuration, expected outputs, and test results, making organization simple. This tool is an extension of a previous project by Dimitri Fontaine and part of the boringSQL initiative, aimed at improving SQL testing practices.
Questions about this article
No questions yet.