Re: Constraint Trigger's referenced_table

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: Constraint Trigger's referenced_table
Дата
Msg-id 383573.85613.qm@web31804.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: Constraint Trigger's referenced_table  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Constraint Trigger's referenced_table
Список pgsql-general
--- On Sat, 12/22/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> No, the purpose is to support foreign-key triggers.  FK constraints are
> implemented via cooperating triggers on the two tables, and
> each trigger has to be able to look at the other table.

When you say "each trigger has to be able to look" do you mean that each trigger needs to be notified when other table
hasrecords that are inserted/updated/deleted? 

From what I gathered from the reading of ri_triggers.c, FWIU it seems that this kind of cross table checking is
designedto seek out any FKs or PKs in the related table and then execute a validating query that compares the PK to FK. 

Can this kind of cross checking still be implemented for temporal relations where foreign keys are not actually
implementedin the "referencing" table. 

For example I want to enforce the primary-relation's time range to always engulf the time range of the
foreign-relation.:
PK timeline:

|---p1---|--p2--|-p3-|p4|---p5---|

FK timeline:
  |-f1-|----f2----|--f3--|--f4--|

So if I INSERT/UPDATE/DELETE records to either table, would implementing the "FROM referenced_table" predicated of the
CREATEConstraint Trigger enable this kind of notification to perform cross checking even though there are strictly no
pk/fkrelations between these table? 

Regards,
Richard Broersma Jr.

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

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Constraint Trigger's referenced_table
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: update pg question?