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

From Don Baccus
Subject Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
Date
Msg-id 3.0.1.32.20000114181256.0109cb00@mail.pacifier.com
Whole thread Raw
In response to date/time problem in v6.5.3 and 7.0.0 ...  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
At 10:02 PM 1/14/00 -0400, The Hermit Hacker wrote:
>
>I can add days to now(), but not subtract? 
>
>=====================================
>
>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
>template1=> select version();

donb=> select now()-'30 days'::reltime;
?column?              
----------------------
1999-12-15 18:13:18-08
(1 row)

donb=> select now()-'30 days';
ERROR:  Unable to identify an operator '-' for types 'timestamp' and 'unknown'       You will have to retype this query
usingan explicit cast
 
donb=> 

As a relative newcomer, I too have found dates a bit confusing and
my solution has been to cast like crazy rather than guess what will
happen if I don't :)



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: date/time problem in v6.5.3 and 7.0.0 ...
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Re: Peter opens a can of worms