{"slug": "pgtap", "name": "pgTAP", "category": "databases", "category_name": "Databases", "description": "", "recommenders": 3, "commenters": 5, "warners": 0, "score": 2.954, "rising": -0.98, "first": "2025-11-14", "latest": "2026-03-21", "why": "it's an excellent mature tool for unit-testing your database", "why_is_quote": true, "has_verdict": false, "sentiment": {"recommend": 3, "neutral": 2, "compare": 0, "warn": 0}, "spark": [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], "listed": true, "loved": [], "caveat": "", "short_quote": "it's an excellent mature tool for unit-testing your database", "kind": "", "icon": false, "domain": "pgtap.org", "github_repo": null, "official_url": "https://pgtap.org", "pricing": "", "aliases": ["pgTAP"], "verdict": null, "praise": [{"label": "", "summary": "", "quotes": [{"id": 759482433, "item_id": 47467652, "url": "https://news.ycombinator.com/item?id=47467652", "by": "zie", "date": "2026-03-21", "stance": "recommend", "quote": "pgtap[0] is amazing for ensuring our access control", "excerpt": "Well, I mean it's not only RLS, but yes it's only PostgreSQL doing the access control as far as if they can see a particular table or row. Every user gets their own role in PG, so the rest of the PG access control system is also used. We have your normal SSO system(Azure) and if Tootie employee doesn't need access to Asset Control, they don't get any access to the asset schema for instance. What would be your method?", "context": "", "use_case": "Testing database access control", "switched_from": "", "story": "We give every user SQL access to a shared ClickHouse cluster"}, {"id": 734818704, "item_id": 45926169, "url": "https://news.ycombinator.com/item?id=45926169", "by": "ForHackernews", "date": "2025-11-14", "stance": "recommend", "quote": "it's an excellent mature tool for unit-testing your database", "excerpt": "PgTAP is only mentioned offhandedly at the end of this article, but it's an excellent mature tool for unit-testing your database: https://pgtap.org/", "context": "", "use_case": "Unit-testing database", "switched_from": "", "story": "RegreSQL: Regression Testing for PostgreSQL Queries"}]}], "caveats": [], "who": [], "tags": [], "use_cases": ["testing database access control", "unit testing sql", "unit-testing database", "postgres sql unit tests", "postgresql unit testing"], "compared": [{"slug": "postgresql", "name": "PostgreSQL", "co": 2, "switched_from": 0, "switched_to": 0}], "makers": [], "threads": [{"url": "https://news.ycombinator.com/item?id=45924619", "title": "RegreSQL: Regression Testing for PostgreSQL Queries", "mentions": 3}, {"url": "https://news.ycombinator.com/item?id=47414356", "title": "We give every user SQL access to a shared ClickHouse cluster", "mentions": 1}, {"url": "https://news.ycombinator.com/item?id=46176806", "title": "How do you unit test SQL?", "mentions": 1}], "sentiment_by_month": {"2025-11": {"recommend": 2, "neutral": 1}, "2025-12": {"neutral": 1}, "2026-01": {}, "2026-02": {}, "2026-03": {"recommend": 1}, "2026-04": {}, "2026-05": {}, "2026-06": {}, "2026-07": {}, "2026-08": {}, "2026-09": {}, "2026-10": {}}, "quotes": [{"id": 759482433, "item_id": 47467652, "url": "https://news.ycombinator.com/item?id=47467652", "by": "zie", "date": "2026-03-21", "stance": "recommend", "quote": "pgtap[0] is amazing for ensuring our access control", "excerpt": "Well, I mean it's not only RLS, but yes it's only PostgreSQL doing the access control as far as if they can see a particular table or row. Every user gets their own role in PG, so the rest of the PG access control system is also used. We have your normal SSO system(Azure) and if Tootie employee doesn't need access to Asset Control, they don't get any access to the asset schema for instance. What would be your method?", "context": "", "use_case": "Testing database access control", "switched_from": "", "story": "We give every user SQL access to a shared ClickHouse cluster"}, {"id": 739376400, "item_id": 46211025, "url": "https://news.ycombinator.com/item?id=46211025", "by": "DemocracyFTW2", "date": "2025-12-09", "stance": "neutral", "quote": "I used to use https://pgtap.org for a short while but then switched to 'invariant testing'", "excerpt": "FWIW I used to use https://pgtap.org for a short while but then switched to 'invariant testing' (my word for it) where I basically write DDL for views that collect rows that don't look like I expect them to look like. I since moved to SQLite in NodeJS and one of the things I just implemented is views that look at strategic points in the DB\u2014where data is ingested\u2014and tests whether all text fields are Unicode-normalize", "context": "", "use_case": "unit testing SQL", "switched_from": "", "story": "How do you unit test SQL?"}, {"id": 734818704, "item_id": 45926169, "url": "https://news.ycombinator.com/item?id=45926169", "by": "ForHackernews", "date": "2025-11-14", "stance": "recommend", "quote": "it's an excellent mature tool for unit-testing your database", "excerpt": "PgTAP is only mentioned offhandedly at the end of this article, but it's an excellent mature tool for unit-testing your database: https://pgtap.org/", "context": "", "use_case": "Unit-testing database", "switched_from": "", "story": "RegreSQL: Regression Testing for PostgreSQL Queries"}, {"id": 734806098, "item_id": 45925381, "url": "https://news.ycombinator.com/item?id=45925381", "by": "jumski", "date": "2025-11-14", "stance": "neutral", "quote": "setting up state in my pgTAP tests", "excerpt": "Looks really well thought out and I will be testing it for sure! I'm wondering how I would be able to regression-test functions in my project (pgflow [0]) - it tracks a graph of state machines modeled in few tables. State is mutated only by calling few exposed SQL functions (task queue worker does it). Given I can't enforce everything I need with check constraints and I try to avoid triggers if possible, I opted for ", "context": "", "use_case": "Postgres SQL unit tests", "switched_from": "", "story": "RegreSQL: Regression Testing for PostgreSQL Queries"}, {"id": 734800705, "item_id": 45925044, "url": "https://news.ycombinator.com/item?id=45925044", "by": "jci", "date": "2025-11-14", "stance": "recommend", "quote": "", "excerpt": "My goto for this lately has been ephemeralpg [0] and pgTAP [1]. It\u2019s been pretty great [0] https://github.com/eradman/ephemeralpg [1] https://github.com/theory/pgtap", "context": "", "use_case": "PostgreSQL unit testing", "switched_from": "", "story": "RegreSQL: Regression Testing for PostgreSQL Queries"}]}