public inbox for [email protected]
help / color / mirror / Atom feedFixing Integrity check errors
2+ messages / 2 participants
[nested] [flat]
* Fixing Integrity check errors
@ 2022-03-14 20:14 flik <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: flik @ 2022-03-14 20:14 UTC (permalink / raw)
To: [email protected]
Hi!
What would be the best way to solve integrity errors (unique
constraints) caused by a badly done dump/restore? My best guess as
ignorant ass, it's simply to dump the current data (only), start a new
project, apply the migrations and loading back data.
Given that the schema is exactly the same, would this work? If so, how
can I do it with postgres?
I already tried to pg_dump --data-only but I keep getting weird errors.
Sorry if my message is confusing-confused, I'm quite new with databases!
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Fixing Integrity check errors
@ 2022-03-14 21:33 Tom Lane <[email protected]>
parent: flik <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2022-03-14 21:33 UTC (permalink / raw)
To: flik <[email protected]>; +Cc: [email protected]
flik <[email protected]> writes:
> What would be the best way to solve integrity errors (unique
> constraints) caused by a badly done dump/restore? My best guess as
> ignorant ass, it's simply to dump the current data (only), start a new
> project, apply the migrations and loading back data.
> Given that the schema is exactly the same, would this work? If so, how
> can I do it with postgres?
> I already tried to pg_dump --data-only but I keep getting weird errors.
--data-only is really the source of your problem, probably.
If you do a normal (full) pg_dump and restore into an empty
database, then pg_dump should see to loading your data and
installing constraints in the correct order. With --data-only
it can't make as many guarantees.
Usually, however, that only comes up with foreign key constraints.
If you're seeing unique-constraint failures then there might be
something else going on, such as
* you forgot to make sure the tables are empty before adding data
* or there's something corrupt about the indexes
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-03-14 21:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 20:14 Fixing Integrity check errors flik <[email protected]>
2022-03-14 21:33 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox