Re: delete and select with IN clause issues - Mailing list pgsql-sql

From Tom Lane
Subject Re: delete and select with IN clause issues
Date
Msg-id 24512.1162525800@sss.pgh.pa.us
Whole thread Raw
In response to delete and select with IN clause issues  (Jeff Frost <jeff@frostconsultingllc.com>)
Responses Re: delete and select with IN clause issues
List pgsql-sql
Jeff Frost <jeff@frostconsultingllc.com> writes:
> delete from visit where id not in (select distinct visit_id from page_view);

> This yields the following error:

> ERROR:  update or delete on "visit" violates foreign key constraint 
> "fk34afd255fbacabec" on "page_view"
> DETAIL:  Key (id)=(38635629) is still referenced from table "page_view".

This seems pretty darn weird.  I am wondering about corrupt indexes ---
can you find the indicated key in either table if you set
enable_indexscan and enable_bitmapscan to 0?

Also, this is a long shot, but does visit by any chance have a cascading
deletion self-reference?
        regards, tom lane


pgsql-sql by date:

Previous
From: Jeff Frost
Date:
Subject: Re: delete and select with IN clause issues
Next
From: Jeff Frost
Date:
Subject: Re: delete and select with IN clause issues