Re: Rows violating Foreign key constraint exists

From: Nandakumar M <m(dot)nanda92(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Rows violating Foreign key constraint exists
Date: 2019-11-29 07:40:07
Message-ID: CANcFUu5BRQ956PLi_8v6MidvTr3LOdL-hwnMM_hZdiwsFNC8=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

> It could be that somebody disabled the triggers, but that would have to
> be a superuser. And I hope that people randomly disabling system triggers
> on tables don't have superuser access to your database.

It is unlikely that this happened. So I am assuming corruption.
But I am able to query both the referred and referring table
successfully without any 'missing chunk' or similar errors that
usually indicate corruption.
Is it possible that corruption might cause data loss like this without
any errors?

> The other option is that you are suppering from data corruption, perhaps
> because of a software bug, but most likely because of hardware problems.
>
> If you don't know better, assume the worst.
>
> I would test the hardware for problems.
> Once you are sure the hardware is fine, manually fix the corruption
> by deleting rows that violate the constraint.

How do I test for hardware problems? Are there any tools for this? I
am running PG on windows machine.

Thanks.

Regards,
Nanda

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nandakumar M 2019-11-29 08:15:37 Re: Rows violating Foreign key constraint exists
Previous Message Tom Lane 2019-11-29 04:22:24 Re: using replace function