BUG #4119: Add foreign key fails for non-presence of a record that does exist.

From: "Buk" <p9e883002(at)sneakemail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4119: Add foreign key fails for non-presence of a record that does exist.
Date: 2008-04-21 01:58:45
Message-ID: 200804210158.m3L1wj2t013524@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4119
Logged by: Buk
Email address: p9e883002(at)sneakemail(dot)com
PostgreSQL version: 8.2.4,
Operating system: XP SP1
Description: Add foreign key fails for non-presence of a record that
does exist.
Details:

I'm trying to run this:

big_db=# ALTER TABLE word_doc ADD FOREIGN KEY (word_id) REFERENCES words
(word_id) ON UPDATE RESTRICT ON DELETE RESTRICT;

I'm getting this error:

ERROR: insert or update on table "word_doc" violates foreign key constraint
"word_doc_word_id_fkey"
DETAIL: Key (word_id)=(65935) is not present in table "words".

And yet, there is the "missing" key:

big_db=# select * from words where word_id = 65935;
word_id | word
---------+----------------
65935 | bioremediation
(1 row)

What am I doing wrong??

Cheers, Buk.

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2008-04-21 08:15:41 'Too many LWLocks held' with GIN pg_trgm_ops index [RE-SENT]
Previous Message Sam Mason 2008-04-20 19:02:53 Re: BUG #4114: Inconsistent shift operator