Skip site navigation (1) Skip section navigation (2)

Re: Referential Integrity corrupted sometimes by Rules

From: José María Fernández González <jmfernandez(at)cnb(dot)uam(dot)es>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Referential Integrity corrupted sometimes by Rules
Date: 2001-07-06 19:29:09
Message-ID: 3B461185.981821E3@cnb.uam.es (view raw or flat)
Thread:
Lists: pgsql-bugs
Tom Lane wrote:
> 
> pgsql-bugs(at)postgresql(dot)org writes:
> > -- Rule over the referenced table
> > -- which breaks referential integrity
> > create rule nodelrel
> > as on delete to rel
> > where old.ref > 3 and user = 'prueba'
> > do instead nothing;
> 

Hi Tom,

	first of all, my congratulations to the PostgreSQL team, for this fantastic
ORDBMS. I'm working with it since 6.4.2 version, and each improvement since then
is placing PostgreSQL above the other (commercial and non-commercial) products.

> This rule is preventing the foreign key triggers from performing the
> DELETEs implied by your ON DELETE CASCADE command.  If we made the
> triggers bypass the rules, we'd get other complaints about that.
> At the moment, the rule wins.  If you want to propose a different
> behavior, let's hear it.

	But, PostgreSQL makes an external (not internal) difference among triggers and
constraint triggers (described as special and for internal use in the reference
manual). Surely there are many reasons to have only one level of triggers (I'm
thinking on two or three now), but why don't two levels? The first level with
triggers, which can be bypassed by rules, and the second level with constraint
triggers, which cannot be bypassed by them.

	Following with the two levels concept, when you define a trigger you could have
a parameter to set the 'unbypassable' behaviour (with the normal one set as
default), so the database designer could choose when she/he/it needs to tune a
complex design.

	Best regards,
		José María Fernández

-- 
José María Fernández González		e-mail: jmfernandez(at)cnb(dot)uam(dot)es
Tlfn:	(+34) 91 585 49 21		Fax:	(+34) 91 585 45 06
Grupo de Diseño de Proteinas		Protein Design Group
Centro Nacional de Biotecnología	National Center of Biotechnology
C.P.: 28049				Zip Code: 28049
Campus Universidad Autónoma. Cantoblanco, Madrid, Spain.

In response to

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-07-07 00:54:48
Subject: Perl DBI Module fails to install correctly from RPM
Previous:From: Stephan SzaboDate: 2001-07-06 19:28:04
Subject: Re: Referential Integrity corrupted sometimes by Rules

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group