# SQL Regression Tests

DevFeed: [SQL Regression Tests](<https://devfeed.tech/articles/sql-regression-tests-34564.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2017/08/sql-regression-tests/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2017-08-08T15:55:51Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>)

Tags: [postgresql](<https://devfeed.tech/tags/postgresql.md>), [psql](<https://devfeed.tech/tags/psql.md>), [regression](<https://devfeed.tech/tags/regression.md>), [sql](<https://devfeed.tech/tags/sql.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

This article explains how to unit test and regression test SQL queries. It distinguishes unit tests against static arguments and data sets from regression tests that verify a query continues to meet the same contract after changes. It also discusses integrity testing and introduces pgTAP for PostgreSQL unit tests.

## Source excerpt

In a previous article here we saw How to Write SQL in your application code. The main idea in that article is to maintain your queries in separate SQL files, where it's easier to maintain them. In particular if you want to be able to test them again in production, and when you have to work and rewrite queries.