Re: Referential Integrity corrupted sometimes by Rules

Поиск
Список
Период
Сортировка
От José María Fernández González
Тема Re: Referential Integrity corrupted sometimes by Rules
Дата
Msg-id 3B461185.981821E3@cnb.uam.es
обсуждение исходный текст
Ответ на Referential Integrity corrupted sometimes by Rules  (pgsql-bugs@postgresql.org)
Список pgsql-bugs
Tom Lane wrote:
>
> pgsql-bugs@postgresql.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@cnb.uam.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.


В списке pgsql-bugs по дате отправления:

Предыдущее
От: "William M. Shubert"
Дата:
Сообщение: Corrupted index/unique column after vacuuming
Следующее
От: Carl Anderson
Дата:
Сообщение: shared library compile error