Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 58A1E632C0C for ; Thu, 22 Oct 2009 20:16:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94399-05 for ; Thu, 22 Oct 2009 23:15:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 693AD632741 for ; Thu, 22 Oct 2009 20:15:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n9MNFv9Z016907; Thu, 22 Oct 2009 19:15:57 -0400 (EDT) To: the6campbells cc: pgsql-sql@postgresql.org Subject: Re: date + interval year - why is the return type convered to a timestamp? In-reply-to: <22431f1b0910221404i52040b19s7c89f6dda4ae187d@mail.gmail.com> References: <22431f1b0910221404i52040b19s7c89f6dda4ae187d@mail.gmail.com> Comments: In-reply-to the6campbells message dated "Thu, 22 Oct 2009 17:04:50 -0400" Date: Thu, 22 Oct 2009 19:15:57 -0400 Message-ID: <16906.1256253357@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200910/116 X-Sequence-Number: 33315 the6campbells 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