Re: [SQL] Anyone recognise this error from PL/pgSQL?

Поиск
Список
Период
Сортировка
От Howie
Тема Re: [SQL] Anyone recognise this error from PL/pgSQL?
Дата
Msg-id Pine.LNX.3.96.990814030140.8919k-100000@rabies.toodarkpark.org
обсуждение исходный текст
Ответ на Anyone recognise this error from PL/pgSQL?  (Mark Dalphin <mdalphin@amgen.com>)
Список 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 по дате отправления:

Предыдущее
От: Mark Dalphin
Дата:
Сообщение: Anyone recognise this error from PL/pgSQL?
Следующее
От: Michael Olivier
Дата:
Сообщение: new.oid not working inside rule [repost]