Also, triggers are for when you want to be able to raise meaningful errors, right? I tend to use triggers a lot for
thingsI could use rules for, just to catch problems and return error messages that help figure out what happened. I
thoughtyou could not do that with a rule.
Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: ianh@tpchd.org
>>> Bruce Momjian <pgman@candle.pha.pa.us> 07/23/01 02:27PM >>>
See my book chapter at:
http://www.postgresql.org/docs/awbook.html
It discusses when to use each. Basically triggers are for modifying the
row you just inserted/updated, while Rules are for referring to other
tables.
>
>
> "Dr. Evil" wrote:
> >
> > I just want to say, that PG is an awesome thing. I'm finding new uses
> > for constraints of various kinds to ensure data integrity in my DB.
> > Constraints will really make the whole application more solid, because
> > programming errors elsewhere still won't allow corrupt data to get
> > into the DB.
>
> And I thought it was a question about rules :-) Speaking of which can
> someone tell me in which circumstances to use rules and in what
> circumstances to use triggers?
>
> Nils
> --
> Alles van waarde is weerloos
> Lucebert
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
--
Bruce Momjian | http://candle.pha.pa.us
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
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl