Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: The Hermit Hacker <scrappy(at)hub(dot)org>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] date/time problem in v6.5.3 and 7.0.0 ...
Date: 2000-01-15 02:12:56
Message-ID: 3.0.1.32.20000114181256.0109cb00@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 using an 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(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-15 03:04:56 Re: [HACKERS] Re: Peter opens a can of worms
Previous Message The Hermit Hacker 2000-01-15 02:02:39 date/time problem in v6.5.3 and 7.0.0 ...