Re: Problem with REFERENCES on INHERITS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: William Gordon Rutherdale <will(dot)rutherdale(at)utoronto(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with REFERENCES on INHERITS
Date: 2015-02-02 15:11:01
Message-ID: 15673.1422889861@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

William Gordon Rutherdale <will(dot)rutherdale(at)utoronto(dot)ca> writes:
> So this statement:
> INSERT INTO banana_stash(primate_id, qty) VALUES (1, 17);
> Resulted in this error:
> ERROR: insert or update on table "banana_stash" violates foreign key
> constraint "banana_stash_primate_id_fkey"
> DETAIL: Key (primate_id)=(1) is not present in table "primate".

> How am I to interpret this? A select * from primate shows that a row
> with primate.id exists, yet the error message indicates that it doesn't.

If you did "select * from only primate" you would see that there is no
such row in the parent table, which is what the foreign key is being
enforced against.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2015-02-02 17:22:20 Re: cannot start 9.3 after system crash
Previous Message theftp 2015-02-02 14:52:25 Re: BDR Error restarted