Search Postgresql Archives

Re: Constraint Trigger's referenced_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Sat, 12/22/07, Tom Lane <tgl@xxxxxxxxxxxxx> 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 has records 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 designed to 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 implemented in 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 CREATE Constraint Trigger enable this kind of notification to perform cross checking even though there are strictly no pk/fk relations between these table?

Regards,
Richard Broersma Jr.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux