Re: Rule problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kiarash Bodouhi" <kbodouhi(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Rule problem
Date: 2004-10-10 15:53:15
Message-ID: 10802.1097423595@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Kiarash Bodouhi" <kbodouhi(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kiarash Bodouhi 2004-10-10 16:03:18 Re: Rule problem
Previous Message Dawid Kuroczko 2004-10-10 15:52:32 Re: Change query priority