pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: the6campbells <the6campbells@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: date + interval year - why is the return type convered to a timestamp?
Date: Thu, 22 Oct 2009 19:15:57 -0400
Message-ID: <16906.1256253357@sss.pgh.pa.us> (raw)
In-Reply-To: <22431f1b0910221404i52040b19s7c89f6dda4ae187d@mail.gmail.com>
References: <22431f1b0910221404i52040b19s7c89f6dda4ae187d@mail.gmail.com>

the6campbells <the6campbells@gmail.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



view thread (2+ messages)

Message-ID: <16906.1256253357@sss.pgh.pa.us>
Permalink:  ../16906.1256253357@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16906.1256253357@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, the6campbells@gmail.com
  Subject: Re: date + interval year - why is the return type convered to a timestamp?
  In-Reply-To: <16906.1256253357@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox