Re: rules and functions as arguments

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: rules and functions as arguments
Дата
Msg-id 25878.1030629696@sss.pgh.pa.us
обсуждение исходный текст
Ответ на rules and functions as arguments  (Jeff Davis <list-pgsql-general@empires.org>)
Список pgsql-general
Jeff Davis <list-pgsql-general@empires.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: date_part???
Следующее
От: "Ben-Nes Michael"
Дата:
Сообщение: Re: join problem or maybe group :(