Re: date + interval year - why is the return type convered to a timestamp?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: the6campbells <the6campbells(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: date + interval year - why is the return type convered to a timestamp?
Date: 2009-10-22 23:15:57
Message-ID: 16906.1256253357@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

the6campbells <the6campbells(at)gmail(dot)com> writes:
> Why is Postgres returning a timestamp instead of the expected date data type
> for the first expression (the second returns a date)?

> select date '2001-03-30' - interval '1' year, date '2001-03-30' - integer
> '365' from tversion

Would you expect a date for
date '2001-03-30' - interval '1 hour'
? They are type-wise the same case; we don't have different types for
different lengths of interval.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2009-10-22 23:26:37 Re: question about timestamp with tz
Previous Message Tom Lane 2009-10-22 23:13:58 Re: question about timestamp with tz