From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Radoslaw Zielinski *EXTERN*" <radek(at)pld-linux(dot)org>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: 8.4.0 bug - failure to enforce a foreign key constraint |
Date: | 2009-08-14 05:34:36 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C203937EC4@exadv11.host.magwien.gv.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Radoslaw Zielinski wrote:
> radek=# \d kandydaci
> Table "public.kandydaci"
> Column | Type | Modifiers
> -------------------+------------------+-----------
> id_rekordu | bigint | not null
> id_osoby | integer | not null
> id_rodzaju_adresu | smallint |
> score | double precision | not null
[...]
> Foreign-key constraints:
> "kandydaci_fk_id_rekordu" FOREIGN KEY (id_rekordu) REFERENCES rekordy(id) ON DELETE CASCADE
>
> radek=# select count(*), sum((r.id is null)::int) as
> orphans from kandydaci k left join rekordy r on r.id=k.id_rekordu;
> count | orphans
> -------+---------
> 1472 | 152
> (1 row)
>
> The "orphans" count should be 0, obviously.
Just to make sure that there is really an inconsistency:
Could you pg_dump both tables and try to load them into
another database? If that works without errors, we must have
missed something obvious.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Skylar Saveland | 2009-08-14 06:54:20 | drop key translation |
Previous Message | Christophe Pettus | 2009-08-14 05:24:59 | Video from the August 11, 2009 SFPUG meeting available |