Re: Date column that defaults to 'now'
| От | Michael Glaesemann |
|---|---|
| Тема | Re: Date column that defaults to 'now' |
| Дата | |
| Msg-id | 47FD71B4-3FC6-11D8-BA4F-000A95C88220@myrealbox.com обсуждение исходный текст |
| Ответ на | Date column that defaults to 'now' (John Siracusa <siracusa@mindspring.com>) |
| Ответы |
Re: Date column that defaults to 'now'
|
| Список | pgsql-general |
Hi John!
On Jan 5, 2004, at 3:00 PM, John Siracusa wrote:
> How can I create a non-null date column that defaults to 'now' as
> computed
> at the time the row is inserted?
How about this?
test=# create table johns (comment text not null,this_time timestamp
not null default now(), this_date date not null default now());
CREATE TABLE
test=# insert into johns (comment) values ('Ars Technica rocks!');
INSERT 1196312 1
test=# select * from johns;
comment | this_time | this_date
---------------------+----------------------------+------------
Ars Technica rocks! | 2004-01-05 15:25:52.501707 | 2004-01-05
(1 row)
(If you're not the John Siracusa who writes for Ars Technica, the
sentiment still holds. :) )
Regards,
Michael Glaesemann
grzm myrealbox com
В списке pgsql-general по дате отправления: