| From: | Jeff Williams <jeffw(at)globaldial(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Update timestamp on update |
| Date: | 2005-10-13 02:42:06 |
| Message-ID: | 434DC97E.7000603@globaldial.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs pgsql-sql |
Tom Lane wrote:
>Jeff Williams <jeffw(at)globaldial(dot)com> writes:
>
>
>> last_status_change timestamp DEFAULT now()
>>
>>
>
>
>
>>What I would like is that whenever the status is changed the
>>last_status_change timestamp is updated to the current time.
>>
>>
>
>For this you use an ON UPDATE trigger; rules are not a good way to solve
>it. See the documentation about triggers. The first example on this
>page does it along with a few other things:
>http://developer.postgresql.org/docs/postgres/plpgsql-trigger.html
>
>
Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't
really indicate a way I could do this easily and scared me with a lot of
c code. Maybe it is a good idea to present some of the more common
things you would want to do with triggers in the triggers chapter?
Jeff
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-10-13 02:52:04 | Re: [SQL] Update timestamp on update |
| Previous Message | Tom Lane | 2005-10-13 01:44:49 | Re: Update timestamp on update |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-10-13 02:52:04 | Re: [SQL] Update timestamp on update |
| Previous Message | Stewart Ben (RBAU/EQS4) * | 2005-10-13 02:02:42 | Re: SEVEN cross joins?!?!? |