Re: delete and select with IN clause issues

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: delete and select with IN clause issues
Date: 2006-11-03 03:50:00
Message-ID: 24512.1162525800@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jeff Frost <jeff(at)frostconsultingllc(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Frost 2006-11-03 04:37:00 Re: delete and select with IN clause issues
Previous Message louis gonzales 2006-11-03 03:21:55 Re: Is there anyway to...