Re: [GENERAL] Trigger
От | Bruce Momjian |
---|---|
Тема | Re: [GENERAL] Trigger |
Дата | |
Msg-id | 200003071436.JAA19804@candle.pha.pa.us обсуждение исходный текст |
Ответ на | RE: [GENERAL] Trigger (Andrzej Mazurkiewicz <andrzej.mazurkiewicz@polkomtel.com.pl>) |
Ответы |
Re: Trigger
|
Список | pgsql-general |
> Switch to v7.0 beta1 and use FOREIGN KEY. You will save a lot of time. > Before you really finish your development there will be 7.0 production (this > is my private estimation). > Andrzej Mazurkiewicz > > > I am trying to create a trigger for a detail table to check that value > > what is entered exists in master table. > > For example into CustomerOrder table could not be enterd order for > > Customer what does not exists. Not only that he'll save some time. Without the deferred trigger queue manager, watching that one and the same row cannot be modified twice inside of one transaction (WRT key changes), it's possible to fool the trigger and end up with inconsistent data in a multiuser environment. And don't forget that the INSERT of the FK and the DELETE of the PK can happen simultaneously. Due to MVCC, both transactions don't know about each other (thanks to Vadim). Jan from Philly -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
В списке pgsql-general по дате отправления: