Is the data actually right?

Checks a PostgreSQL database from raw sources up — recomputing key figures, running cross-table sanity checks, spotting duplicate entities, and fixing only proven shared causes.

Broken or slowBugs, speed and dataRecipeDepends on the task

As one prompt13 linesRDBR01

StarMarkdown
Is the data actually right? Verify key PostgreSQL figures against original sources before changing anything.

Run these steps one at a time. Wait for my yes after each step. Stay read-only during Steps 1, 2, and 4 — never edit production data, schemas, or app code until I approve Step 3.

Step 1 (prove numbers and cross-check tables — read-only): Pick representative important figures and independently reconstruct them from raw sources without trusting existing calculation code. Also test cross-table totals, accounting identities, plausible ranges, and source coverage for data that passes constraints yet is analytically wrong. Bring back: independent rebuilds, failed cross-table reconciliations, affected row counts, and shared causes (file:line). Stop if the database stores only raw entries with no derived figures.

Step 2 (identity & history — read-only, run only if Step 1 points here): Check whether real-world entities (customers, companies, products) were duplicated or wrongly merged across imports, and whether today's rules rewrite past records' historical meaning. Bring back: concrete duplicate/merge examples with the matching rule (file:line), or past records whose meaning shifted.

Step 3 (targeted fix): After I approve, fix only the confirmed shared causes and add SQL or metric regression tests for them.

Step 4 (proof): Show recomputed examples that now match their sources, how many records were affected, and any source gaps stated plainly.

Start your report in plain English: what you found, what it means, and whether I need to do anything. Put files, lines and commands underneath.
Is the data actually right?As one prompt

Steps

  1. 1Source recomputation & cross-table checksrebuild key figures from raw inputs and test cross-table totals (read-only)
  2. 2Entity identity & historical meaningcheck for split/merged records and retroactive rule changes (read-only)
  3. 3Fix confirmed shared causesapply targeted fixes plus repeatable SQL/metric checks after approval
  4. 4Independent verificationshow before/after recomputed examples and state any remaining source limits
Use it when
Important numbers in a Postgres database must be verified before anyone relies on them.