Re: serial data type - Mailing list pgsql-general

From Doug McNaught
Subject Re: serial data type
Date
Msg-id 87r7opq360.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Re: serial data type  (Joseph Healy <joe_healy@dodo.com.au>)
Responses Re: serial data type
List pgsql-general
Joseph Healy <joe_healy@dodo.com.au> writes:

> On Sat, Sep 25, 2004 at 07:20:23PM -0400, Tom Allison wrote:
>>
>> Any idea how to set up a timestamp=now on every insert/update ?
>
> when you create your table, use:
>
> create table mytable (
>         id serial primary key,
>     updated timestamp default(now()),
>     mydata int4
> );

That won't change the timestamp on UPDATE queries; you need a trigger
for that.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Joseph Healy
Date:
Subject: Re: serial data type
Next
From: Bruce Momjian
Date:
Subject: Re: using COPY table FROM STDIN within script run as psql