Help with syntax for timestamp addition

Поиск
Список
Период
Сортировка
От Scott Nixon
Тема Help with syntax for timestamp addition
Дата
Msg-id 1101131750.23253.1.camel@talon
обсуждение исходный текст
Ответы Re: Help with syntax for timestamp addition  ("Patrick Fiche" <patrick.fiche@aqsacom.com>)
Re: Help with syntax for timestamp addition  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
New to Postgres 7.3 from 7.0.

Am having some trouble with a query that worked in 7.0 but not in
7.3.....can't seem to figure out the syntax or find info about how to do
this anywhere.

Consider for the following query:
- 'number' is an integer
- 'procedures' is the table name
- 'date' is a timestamp
- 'numdays' is an integer

SELECT number
FROM procedures
WHERE date + numdays <= CURRENT_TIMESTAMP;

In 7.0 this works with no problem...finding all rows where the date plus
some number of days is less than the current. But in 7.3 I get:

ERROR: Unable to identify an operator '+' for types 'timestamp without
time zone' and 'integer'
You will have to retype this query using an explicit cast


I've never had to create casts before so I'm not too sure how to work
this casting into the query....keep getting various syntax errors no
matter what I try. If I try to incorporate intervals, I also get errors.
I just can't seem to find good examples in any documentation.

Any help is appreciated.

-Scott





В списке pgsql-general по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: Tsearch2 and Unicode?
Следующее
От: Geoffrey
Дата:
Сообщение: Re: How to handle larger databases?