Re: three timestamps/table, use of 'now' in table creation statement
От | codeWarrior |
---|---|
Тема | Re: three timestamps/table, use of 'now' in table creation statement |
Дата | |
Msg-id | b06k5l$bga$1@news.hub.org обсуждение исходный текст |
Ответ на | Re: three timestamps/table, use of 'now' in table creation statement (Bruno Wolff III <bruno@wolff.to>) |
Ответы |
Re: three timestamps/table, use of 'now' in table creation statement
|
Список | pgsql-general |
"Bruno Wolff III" <bruno@wolff.to> wrote in message news:20030116144423.GA24326@wolff.to... > Please don't reply to existing threads to start new ones. > > On Thu, Jan 16, 2003 at 01:08:09 -0800, > Dennis Gearon <gearond@cvc.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
В списке pgsql-general по дате отправления: