From: | "codeWarrior" <GPatnude(at)adelphia(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: three timestamps/table, use of 'now' in table creation statement |
Date: | 2003-01-16 15:53:46 |
Message-ID: | b06k5l$bga$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Bruno Wolff III" <bruno(at)wolff(dot)to> wrote in message
news:20030116144423(dot)GA24326(at)wolff(dot)to(dot)(dot)(dot)
> Please don't reply to existing threads to start new ones.
>
> On Thu, Jan 16, 2003 at 01:08:09 -0800,
> Dennis Gearon <gearond(at)cvc(dot)net> wrote:
> > I want to have three timestamps columns in a table:
> >
> > What I want to happen is that all three columns get set with the 'now'
> > value to the nearest second, and they ALL have the exact same value.
>
> You will get the same value if the three times are all obtained within
> the same transaction.
In your table schema:
"change_dt" timestamptz NULL default 'NOW()',
Which makes absolute sense on an INSERT -- INSERT tblName (field) VALUES
(nval, nval, ) will AUTOMAGICALLY set your fields to their default...
When you UPDATE -- Only update the colums you needs AND change_dt
Ya' know.... UPDATE tblName set dad = '', dada2 = '', change_dt = 'NOW()'...
WHERE dada = dada...
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-01-16 16:01:30 | Re: Force index usage on bigint in PL/PGSQL |
Previous Message | Geert Bevin | 2003-01-16 15:22:55 | Unsolveable query? |