lists@adontendev.net <lists@adontendev.net> schrieb:
>
>
> This issue always stumps me. I need to set the default date for a column in
> postgres. A value for today, today + x days, now (timestamp), now + x amount of
> days.
test=# select current_date;
date
------------
2006-02-20
(1 row)
test=# select current_date + '5 days'::interval;
?column?
---------------------
2006-02-25 00:00:00
(1 row)
test=# select now();
now
-------------------------------
2006-02-20 17:56:24.136771+01
(1 row)
test=# select now() + '5 days'::interval;
?column?
-------------------------------
2006-02-25 17:56:29.780316+01
(1 row)
test=# create table foo (id int, datum date default current_date + '5 days'::interval);
CREATE TABLE
test=# insert into foo (id) values (1);
INSERT 0 1
test=# select * from foo;
id | datum
----+------------
1 | 2006-02-25
HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°