Re: automatic time/user stamp - rule or trigger?

From: "codeWarrior" <GPatnude(at)adelphia(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: automatic time/user stamp - rule or trigger?
Date: 2003-02-05 23:38:52
Message-ID: b1s6rm$1c1b$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You're doing update right ??? Just update the column... It's even easier if,
when you do your updates... You just:

UPDATE blah SET field = value,...., updatestamp = 'Now()' WHERE
condition...

GP

"Neal Lindsay" <neal(dot)lindsay(at)peaofohio(dot)com> wrote in message
news:b1r864$2mpp$1(at)news(dot)hub(dot)org(dot)(dot)(dot)
> I have a table that I want to keep track of the user who last modified
> it and the timestamp of the modification. Should I use a trigger or a
rule?
>
> CREATE TABLE stampedtable (
> stampedtableid SERIAL PRIMARY KEY,
> updatestamp timestamp NOT NULL DEFAULT now(),
> updateuser name NOT NULL DEFAULT current_user,
> sometext text
> );
>
> I suspect that I want a rule, but all the examples in the documentation
> seem to update a separate table and not override (or add) the
> insert/update to the timestamp and name columns.
>
> Thanks,
> -Neal
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rodger Donaldson 2003-02-06 04:02:48 to_date has beaten me...
Previous Message Achilleus Mantzios 2003-02-05 19:48:30 Re: automatic time/user stamp - rule or trigger?