Обсуждение: sql date functions

Поиск
Список
Период
Сортировка

sql date functions

От
BD Postgres
Дата:
Hello,

I am new to postgress and SQL and I don't know how to use the date
functions:
I need to insert two dates in a row, the first been a week before the
second but I don't know how this can be achieved, I have tried:

insert into table1 (date1,date2) values('1997-2-3::date','1997-2-3::date
+ timespan(1 week)');

that is what I think that should be, and all the variations I have
imagined, but it hasn't worked, I'm doing this from perl with the DBI
interface, but I don't think that to precompute the second date first in
perl is a good idea, I prefer to let postgress do it if possible.

the errors reported by postmaster are like this:
ERROR:  Bad date external representation 1/2/2003::date + timespan(1
week)

Could somebody tell me which is the correct way to get this working ?

Thank you.

 - Salvador Fandiño.


P.S. I have previusly posted this msg in the NOVICE mailing list, but
nobody seems to know how to do it there.