Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ... - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
Date
Msg-id 38847B5B.DA4BEE00@alumni.caltech.edu
Whole thread Raw
In response to date/time problem in v6.5.3 and 7.0.0 ...  (The Hermit Hacker <scrappy@hub.org>)
Responses Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
List pgsql-hackers
> > I can add days to now(), but not subtract?

The problem is that it is meaningful to subtract two absolute times,
giving a delta time as a result, *and* it is meaningful to subtract a
delta time from an absolute time, giving another absolute time as a
result. 

So your unspecified field could be either one, and Postgres can't
decide what it should be for you ;)

The error message is intentionally vague, since by the time the
message is printed the parser has lost track of whether there were
zero candidates or too many candidates.
                     - Thomas

> > =====================================
> >
> > template1=> select now() + '30 days';
> >            ?column?
> > ------------------------------
> >  Sun Feb 13 22:00:33 2000 AST
> > (1 row)
> >
> > template1=> select now() - '30 days';
> > ERROR:  Unable to identify an operator '-' for types 'timestamp' and 'unknown'
> >         You will have to retype this query using an explicit cast

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Jose Soares
Date:
Subject: Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Cannot compile psql