Re: Rule problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Rule problem
Дата
Msg-id 10802.1097423595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Rule problem  ("Kiarash Bodouhi" <kbodouhi@yahoo.com>)
Ответы Re: Rule problem  ("Kiarash Bodouhi" <kbodouhi@yahoo.com>)
Список pgsql-general
"Kiarash Bodouhi" <kbodouhi@yahoo.com> writes:
> I tried to use following rule instead of using a default value

You can't ... at least not that way.

> (I want to be
> able to put a function instead of the constant value later on).

There's nothing stopping you from putting a function into the DEFAULT
clause.

A "BEFORE INSERT" trigger is another possible approach.

Novices often think that rules are simpler to use than triggers,
but in my experience the opposite is true.  Triggers have some
notational ugliness but the conceptual model is simple ... for
rules the notation looks easy but wrapping your head around what
will really happen is another story.

            regards, tom lane

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

Предыдущее
От: Dawid Kuroczko
Дата:
Сообщение: Re: Change query priority
Следующее
От: "Kiarash Bodouhi"
Дата:
Сообщение: Re: Rule problem