Thread: Foreign Keys
Hi, What do I have to do to implement Foreign Keys in Postgres 6.3.2 ? Does anyone have the set of triggers to implement it? When is new version which implements it is being released? Thanks, Anand
Anand Surelia wrote: > > Hi, > What do I have to do to implement Foreign Keys in Postgres 6.3.2 ? > > Does anyone have the set of triggers to implementit? Take a look at Postgresql-6.3.2/contrib/spi/refint* there's an example how to implement referential integrity using triggers. > When is new version which implements it is being released? I don't know but I hope soon. Jose'
hi! You should check in contrib/spi subdirectory of Postgres source. There are some useful triggers here, and some of them dedicated to referential integrity. Al. On Thu, 10 Sep 1998, Anand Surelia wrote: > Hi, > What do I have to do to implement Foreign Keys in Postgres 6.3.2 ? Does > anyone have the set of triggers to implement it? When is new version > which implements it is being released? > Thanks, > Anand > >
Hi, I've managed to hack the code for check_primary_key. It now allows for a option [automatic|dependent]. It'll automatically insert into the parent table if the primary key doesn't exists in the parent table and if the option is "automatic". It works the same as before if the option is "dependent". If anybody is interested I might polish the code a bit and post to the list. Thanks, Anand.