Help with syntax for timestamp addition - Mailing list pgsql-general

From Scott Nixon
Subject Help with syntax for timestamp addition
Date
Msg-id 1101131750.23253.1.camel@talon
Whole thread Raw
Responses Re: Help with syntax for timestamp addition
Re: Help with syntax for timestamp addition
List 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 by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: Tsearch2 and Unicode?
Next
From: Geoffrey
Date:
Subject: Re: How to handle larger databases?