Jeff Frost <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to