Re: rules and functions as arguments

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <list-pgsql-general(at)empires(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: rules and functions as arguments
Date: 2002-08-29 14:01:36
Message-ID: 25878.1030629696@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <list-pgsql-general(at)empires(dot)org> writes:
> Is there a way I can make it only do a function call once, and use the value
> after that for all NEW.id's?

No. A rule is a macro, and so it has all the standard issues about
multiple evaluations of arguments.

> Is a trigger a better option here perhaps?

Yes. If you want access to the specific values inserted, a trigger is
almost always a better bet.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-08-29 14:26:18 Re: join problem or maybe group :(
Previous Message Stephan Szabo 2002-08-29 13:59:08 Re: date_part???