Prompt·Writes and ingestion·PG08

Can we rerun everything without damaging the data?

Imports get retried, schedulers overlap, files are replayed, or runs fail halfway.

Markdown
Prompt
Examine the ingestion and correction workflows under retries, interrupted runs, duplicate source files, out-of-order arrivals and repeated execution. Demonstrate where these cases produce duplicate records, lost corrections, partial results or unnecessary rewrites. Find the smallest durable approach that makes each operation safely repeatable.
What it returns
Replay scenarios with their conflict keys, interrupted-run cases, before-and-after data comparisons and a safe way to resume.
Skip it when
Every import runs once, by hand, with nothing to retry.
Avoid
Calling an import safe to rerun just because the SQL has ON CONFLICT.
Changes
Changes nothing
Sessions
Look first, then fix in a new session
Tools
Needs: the repository and read-only database access. Helps: an isolated database for replay tests, and pgTAP.
Works on
Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.

Related prompts

More in Writes and ingestion.