pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: herbertsilver@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13572: Foreign Key Corruption
Date: Fri, 14 Aug 2015 17:07:42 -0400
Message-ID: <13106.1439586462@sss.pgh.pa.us> (raw)
In-Reply-To: <20150814163919.2606.38687@wrigleys.postgresql.org>
References: <20150814163919.2606.38687@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

herbertsilver@gmail.com writes:
> I'm having a bug here. I have a main table and another one referencing to
> its primary key. I'm being able to delete records from the main table at the
> same time postgres keeps the orphaneds rows on the second one.

> I belive it's because of a rule I'm using that is causing the bug, although
> I think it was not supposed to happen anyway.

Yup.  Rules act at a level lower than foreign keys, ie a rule can rewrite
the query that is trying to implement ON DELETE CASCADE.  And here you
have an ON DELETE DO INSTEAD rule on the target table.  This is not a bug,
it's just the way those two features work together.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <13106.1439586462@sss.pgh.pa.us>
Permalink:  ../13106.1439586462@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13106.1439586462@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, herbertsilver@gmail.com
  Subject: Re: BUG #13572: Foreign Key Corruption
  In-Reply-To: <13106.1439586462@sss.pgh.pa.us>
  References: <20150814163919.2606.38687@wrigleys.postgresql.org> <13106.1439586462@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