Violation of non existing reference

From: js(at)deriva(dot)de
To: pgsql-general(at)postgresql(dot)org
Subject: Violation of non existing reference
Date: 2008-03-06 15:20:53
Message-ID: acc97dc8-3d61-4f7d-9117-9a4d3c0fbf2f@v3g2000hsc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2008-03-06 15:23:54 Re: mssql to postgres problems with bytea help needed
Previous Message robert 2008-03-06 14:32:20 mssql to postgres problems with bytea help needed