Thread: timestamps

timestamps

From
Tom Allison
Date:
How would I specify a field that's to be updated to current_time
everytime the row is created/altered?

Is there some way to put this 'update' property into the table instead
of running some query to do it?


Re: timestamps

From
Doug McNaught
Date:
Tom Allison <tallison@tacocat.net> writes:

> How would I specify a field that's to be updated to current_time
> everytime the row is created/altered?

Create a trigger.  There are some good examples in the PL/pgSQL docs.

> Is there some way to put this 'update' property into the table instead
> of running some query to do it?

Triggers are the way to go in Postgres.

-Doug

Re: timestamps

From
Larry Rosenman
Date:

--On Tuesday, May 25, 2004 20:52:22 -0400 Tom Allison
<tallison@tacocat.net> wrote:

> How would I specify a field that's to be updated to current_time
> everytime the row is created/altered?
>
> Is there some way to put this 'update' property into the table instead of
> running some query to do it?
You are looking for a trigger.


>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>



--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

Attachment

Re: timestamps

From
Tom Allison
Date:
Doug McNaught wrote:
> Tom Allison <tallison@tacocat.net> writes:
>
>
>>How would I specify a field that's to be updated to current_time
>>everytime the row is created/altered?
>
>
> Create a trigger.  There are some good examples in the PL/pgSQL docs.
>
>
>>Is there some way to put this 'update' property into the table instead
>>of running some query to do it?
>
>
> Triggers are the way to go in Postgres.
>
> -Doug
>

Thanks for the pointer.  That should be enough.