Interview practice question
Tests pass with H2 but fail with PostgreSQL
Backend Engineering · Testing · Intermediate
Your repository tests use an in-memory H2 database and pass, but queries fail in production on PostgreSQL. What should you change?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- In-memory DBs differ in SQL dialect and behaviour.
- Test against same engine/version.
- Testcontainers Postgres.
- Catch JSON, locking, index behaviours.
- Keep logic tests DB-free.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.