Violation of non existing reference - Mailing list pgsql-general

From js@deriva.de
Subject Violation of non existing reference
Date
Msg-id acc97dc8-3d61-4f7d-9117-9a4d3c0fbf2f@v3g2000hsc.googlegroups.com
Whole thread Raw
Responses Re: Violation of non existing reference
List pgsql-general
Hi,

I encountered an odd behaviour when I tried to delete a record.
I have two tables "z_base" and "z_ul". z_base's primary key is "isin"
which is referenced by z_ul.

select count(*) from z_base where isin = 'DE000DB3BTR9';
 count
-------
     1

select count(*) from z_ul where isin = 'DE000DB3BTR9';
 count
-------
     0

So there is no record in z_ul that references z_base with isin
'DE000DB3BTR9', but when I do:

delete from z_base where isin = 'DE000DB3BTR9';
ERROR:  update or delete on table "z_base" violates foreign key
constraint "z_ul_isin_fkey" on table "z_ul"
DETAIL:  Key (isin)=(DE000DB3BTR9) is still referenced from table
"z_ul".

Has anyone an idea how this could happen?

Jan

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: mssql to postgres problems with bytea help needed
Next
From: Tom Lane
Date:
Subject: Re: Violation of non existing reference