Re: [GENERAL] Trigger

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrzej Mazurkiewicz <andrzej(dot)mazurkiewicz(at)polkomtel(dot)com(dot)pl>
Cc: "'Raigo Lukk'" <l950681(at)ttu(dot)ee>, pgsql-general(at)postgreSQL(dot)org, wieck(at)debis(dot)com
Subject: Re: [GENERAL] Trigger
Date: 2000-03-07 14:36:02
Message-ID: 200003071436.JAA19804@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Henk van Lingen 2000-03-07 14:38:16 Compiling 7.0 on Solaris
Previous Message Alfred Perlstein 2000-03-07 13:58:34 Re: [GENERAL] Trigger