---
title: "Comment by BaoDev Studio on \"The Two Postgres Bugs the Tests Caught: A Real-DB Integration Test Case Study\\n\" | Hashnode"
description: "The \"GRANTs that grant nothing\" class is the one I keep getting bitten by — specifically when GRANT runs in the migration session that owns the objects (so it l"
url: "https://hashnode.com/posts/the-two-postgres-bugs-the-tests-caught-a-real-db-integration-test-case-studyn/69fc923aa0e40af9c8e5d5f3/comment/6a0c67c1883727741155c0fc"
---

[Discussion](https://hashnode.com/posts/the-two-postgres-bugs-the-tests-caught-a-real-db-integration-test-case-studyn/69fc923aa0e40af9c8e5d5f3)

Comment [The Two Postgres Bugs the Tests Caught: A Real-DB Integration Test Case Study\\n](https://hashnode.com/posts/the-two-postgres-bugs-the-tests-caught-a-real-db-integration-test-case-studyn/69fc923aa0e40af9c8e5d5f3)

[BaoDev Studio](https://hashnode.com/@baodev-studio)

[May 19](https://hashnode.com/posts/the-two-postgres-bugs-the-tests-caught-a-real-db-integration-test-case-studyn/69fc923aa0e40af9c8e5d5f3/comment/6a0c67c1883727741155c0fc)

The "GRANTs that grant nothing" class is the one I keep getting bitten by — specifically when GRANT runs in the migration session that owns the objects (so it looks correct) but the role being granted to doesn't exist yet in some tenant-provisioning order-of-operations. Mocks let that slip through every time.

One more bug-class that only real-DB integration testing catches: query plans regressing because statistics are stale. A query that runs 30ms locally on a hot cache + fresh stats can take 4s in prod with 4-week-old pg\_statistic and the planner picking a Nested Loop instead of Hash Join. autoanalyze threshold drift on slow-growth tables is the silent killer.

Worth adding a testcontainer case that does a heavy INSERT, runs the read query, and asserts the plan shape via EXPLAIN — catches plan regressions before they ship.
