Re: Touch row ? - Mailing list pgsql-general

From Tom Lane
Subject Re: Touch row ?
Date
Msg-id 4636.1074977894@sss.pgh.pa.us
Whole thread Raw
In response to Re: Touch row ?  (Eric Ridge <ebr@tcdi.com>)
Responses Re: Touch row ?  (Eric Ridge <ebr@tcdi.com>)
List pgsql-general
Eric Ridge <ebr@tcdi.com> writes:
> On Jan 24, 2004, at 2:34 PM, Tom Lane wrote:
>> A different tack that might be interesting to think about is to invent
>> a notion of an "update default" for a column, analogous to the existing
>> "insert default".

> This thought ran through my head last night.  Something like:

> CREATE TABLE foo (
>     id int4 DEFAULT nextval('foo_seq'),
>           d timestamp DEFAULT now() ON UPDATE now()
> );

> But it seems that if the user explicitly provided a value for 'd',
> you'd want to use that over the computed value.

True.  So if your goal is to force the timestamp column to be the
correct value even when the user tries to set it to something else,
you'd still have to use a trigger or rule.

            regards, tom lane

pgsql-general by date:

Previous
From: Eric Ridge
Date:
Subject: Re: Touch row ?
Next
From: Eric Ridge
Date:
Subject: Re: Touch row ?