Re: Need help : Weird referencial Integrity triggers - Mailing list pgsql-general

From Jan Wieck
Subject Re: Need help : Weird referencial Integrity triggers
Date
Msg-id 200010071144.GAA14039@jupiter.jw.home
Whole thread Raw
In response to Need help : Weird referencial Integrity triggers  ("Vilson farias" <vilson.farias@digitro.com.br>)
List pgsql-general
Vilson farias wrote:
> I've been changing some tables and I saw a strange behavior in pg_trigger.
> Check out the commented code below :
>
> [...]
>
> Now, if I select the corresponding triggers from pg_trigger, I'll find
> three. Why 3? One for update, one for insert and one for delete ?

    One  for  INSERT/UPDATE  of  the  foreign  key table, one for
    DELETE and one for UPDATE of the primary key table.

    You haven't specified a referential  action  for  the  UPDATE
    case  of  the primary key (ON UPDATE ...). The default action
    is NO ACTION, what means that changing the primary keys value
    isn't  allowed as long as there are references to it from any
    foreign key. Thus, updating a PK can  never  be  ignored  and
    there must be a trigger.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



pgsql-general by date:

Previous
From: Michael Meskes
Date:
Subject: Re: Using UnixODBC and postgresql
Next
From: Jan Wieck
Date:
Subject: Re: How does TOAST compare to other databases' mechanisms?