pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Frost <jeff@frostconsultingllc.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: delete and select with IN clause issues
Date: Thu, 02 Nov 2006 22:50:00 -0500
Message-ID: <24512.1162525800@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.64.0611021541050.29554@discord.home.frostconsultingllc.com>
References: <Pine.LNX.4.64.0611021541050.29554@discord.home.frostconsultingllc.com>

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



view thread (12+ messages)  latest in thread

Message-ID: <24512.1162525800@sss.pgh.pa.us>
Permalink:  ../24512.1162525800@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24512.1162525800@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeff@frostconsultingllc.com
  Subject: Re: delete and select with IN clause issues
  In-Reply-To: <24512.1162525800@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox