Re: [SQL] Anyone recognise this error from PL/pgSQL? - Mailing list pgsql-sql

From Howie
Subject Re: [SQL] Anyone recognise this error from PL/pgSQL?
Date
Msg-id Pine.LNX.3.96.990814030140.8919k-100000@rabies.toodarkpark.org
Whole thread Raw
In response to Anyone recognise this error from PL/pgSQL?  (Mark Dalphin <mdalphin@amgen.com>)
List pgsql-sql
On Fri, 13 Aug 1999, Mark Dalphin wrote:

> Hi,
>
> I'm trying my first PL/pgSQL code to trap foreign key errors. Before
> inserting into the table "Exon", I wish to be sure that a foreign key,
> 'zhvtID', exists in the table 'zhvt'. Sounds simple... 

erm, why not use refint's check_(primary|foreign)_key() functions to
handle this ?

-- referential integrity: cascade deletes from zhvt to exon based on zhvtID
create trigger zhvt_zhvtID_trigbefore delete or update on zhvtfor each rowexecute procedure check_foreign_key ('1',
'cascade','zhvtID', 'exon',
 
'zhvtID' );

-- referential integrity: exon.zhvtid must exist in zhvt
create trigger exon_zhvtid_fkbefore insert or update on exonfor each rowexecute procedure check_primary_key( 'zhvtid',
'zhvt','zhvtid' );
 

> [SNIP]

---
Howie <caffeine@toodarkpark.org>   URL: http://www.toodarkpark.org    
"The distance between insanity and genius is measured only by success."



pgsql-sql by date:

Previous
From: Mark Dalphin
Date:
Subject: Anyone recognise this error from PL/pgSQL?
Next
From: Michael Olivier
Date:
Subject: new.oid not working inside rule [repost]