Row exists in a table that violates Foreign key constraint

Started by Nandakumar Mover 7 years ago2 messagesbugs
Jump to latest
#1Nandakumar M
m.nanda92@gmail.com

Hi,

I have a table with a FK constraint to another table. There exists one row
on the referring table with no corresponding row on the referred table. I
tried validating the constraint but that did not produce any errors. This
is on a older version of Postgres (9.2.4)

Please find attached the query outputs showing the issue.

On checking postgres bugs mailing list found that the issue I am facing is
exactly the same as the one mentioned below.

/messages/by-id/200704191356.l3JDufEo052753@wwwmaster.postgresql.org

I have not done any VACUUM FULL on the table as suggested on this thread
though. It would be great if someone can confirm if this is an identified
issue and also let me know how to fix the inconsistency.

If any other information is needed for further analysis I can share the
same.

Regards,
Nanda

Attachments:

pg_fk_bug.txttext/plain; charset=US-ASCII; name=pg_fk_bug.txtDownload
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Nandakumar M (#1)
Re: Row exists in a table that violates Foreign key constraint

Nandakumar M <m.nanda92@gmail.com> writes:

I have a table with a FK constraint to another table. There exists one row
on the referring table with no corresponding row on the referred table. I
tried validating the constraint but that did not produce any errors. This
is on a older version of Postgres (9.2.4)

9.2.x is out of support; moreover, the last release in that series was
9.2.24, so you are missing a large number of bug fixes, including some
known data-corruption hazards.

If you can replicate this problem on an up-to-date Postgres release,
we'd be quite interested, but nobody is likely to spend any effort
looking into problems in 9.2.4.

regards, tom lane