Re: Touch row ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eric Ridge <ebr(at)tcdi(dot)com>
Cc: "Mike Mascari" <mascarm(at)mascari(dot)com>, Jan Wieck <JanWieck(at)Yahoo(dot)com>, "Chris Travers" <chris(at)travelamericas(dot)com>, "NTPT" <ntpt(at)centrum(dot)cz>, "PostgreSQL-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Touch row ?
Date: 2004-01-24 20:58:14
Message-ID: 4636.1074977894@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

Eric Ridge <ebr(at)tcdi(dot)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

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Eric Ridge 2004-01-24 21:19:23 Re: Touch row ?
Previous Message Eric Ridge 2004-01-24 20:45:47 Re: Touch row ?

Browse pgsql-general by date

  From Date Subject
Next Message Eric Ridge 2004-01-24 21:19:23 Re: Touch row ?
Previous Message Eric Ridge 2004-01-24 20:45:47 Re: Touch row ?