SQLTy vs pgdeadbolt¶
Both stop PostgreSQL migrations that would lock tables, a common mistake in migrations that
coding agents write. pgdeadbolt is a TypeScript
linter on libpg_query with 16 rules and suggested rewrites. SQLTy's migration rules run in
sqlty breaking against the existing schema. This page runs pgdeadbolt's test suite through SQLTy.
Quick comparison¶
| pgdeadbolt 0.1 | SQLTy 0.10 | |
|---|---|---|
| Dangerous forms in its 23 rule cases | Its own tests pass | 19 of 19 that map to a SQLTy rule |
| Safe forms flagged | None | None of 23 |
| Renames and drops | Flagged | Reported only when a query reads the object |
| Fixes | Suggests CONCURRENTLY, NOT VALID + VALIDATE, bigserial to bigint |
No fixes |
| PostgreSQL before 11 | pgVersion mode |
No |
| "Wrapped in a transaction" setting | inTransaction |
No |
| Default that calls an unknown function | Warning (may be volatile) | Quiet: only known volatile functions |
| Knows the existing schema | No | Yes |
Where SQLTy is stronger¶
- Schema context: new tables are exempt, and type changes are judged by the column's current type.
- Code context: drops and renames matter only when queries still read the object.
- The same rules cover agents and people, plus the query checks the agent's code needs.
Where pgdeadbolt is stronger¶
- Suggested rewrites for each finding.
- Settings for older PostgreSQL and for tools that wrap each file in a transaction (Flyway, Django).
- Unknown default functions are flagged as possibly volatile.
Which should you choose?¶
Choose pgdeadbolt for a small, focused gate on migration files with ready-made rewrites.
Choose SQLTy when you also want the code that queries those tables checked, and fewer findings on tables the migration just created.
What SQLTy is missing¶
- Fixes for migration rules.
- An
in-transactionsetting for tools that wrap each migration. - A warning for defaults that call unknown functions.
Common questions¶
Does SQLTy rewrite an unsafe migration?¶
No. Its migration rules report the problem, and each rule's page says how to fix it.
Sources¶
- pgdeadbolt 5d8b6a8,
test/rules.test.tsandtest/fixtures; npmpgdeadbolt0.1.0 - SQLTy 0.10.0 run on the same cases (2026-12-01); first run on the migration rule branches (2026-11-20). Two gaps found then (an ignore comment on the line above, and
CREATE INDEXwithout a lock timeout) were fixed in #1234 and #1236