Re: [SQL] few questions about rules: timestamp, new.oid

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Michael Olivier <mo(at)local2me(dot)com>, "pgsql-sql(at)postgreSQL(dot)org" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] few questions about rules: timestamp, new.oid
Date: 1999-08-03 10:32:14
Message-ID: l03130302b3cc756bcae7@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 00:04 +0300 on 03/08/1999, Michael Olivier wrote:

> 1. I'm storing a datetime timestamp for when the change was entered into
> my changes table, but the timestamp doesn't change with subsequent
> tests:
>
> create rule users_modify_rule as on update to users do
> insert into changes (table_name, change_time, ref_oid, type)
> values ('users', 'now', current.oid, 'update');

Better use a function than a constant - try now() instead. A constant
usually gets interpreted at the time of creation. A function remains to be
interpreted at the time of use.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-08-03 15:12:23 Re: bad select performance fixed by forbidding hash joins
Previous Message maxsbox 1999-08-03 06:16:19 Re: [SQL] Using dates