X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 816ECD1B4D3 for ; Tue, 2 Mar 2004 06:25:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42721-04 for ; Tue, 2 Mar 2004 02:25:29 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id CA505D1B4BC for ; Tue, 2 Mar 2004 02:25:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i226PLrM023924; Tue, 2 Mar 2004 01:25:21 -0500 (EST) To: Wojtek Cc: pgsql-sql@postgresql.org Subject: Re: What's wrong with my date/interval arithmetic? In-reply-to: <16712460437.20040302150133@polbox.com> References: <16712460437.20040302150133@polbox.com> Comments: In-reply-to Wojtek message dated "Tue, 02 Mar 2004 15:01:33 +0900" Date: Tue, 02 Mar 2004 01:25:21 -0500 Message-ID: <23923.1078208721@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/20 X-Sequence-Number: 17119 Wojtek writes: > Why is the "result" incorrect (off by one day)? > When I do the exactly same arithmetic using timestamps created > with to_timestamp, everything is OK ("expected_result"). It is not "exactly the same arithmetic", because to_timestamp delivers a result of type timestamp-with-time-zone, whereas your other values are evidently timestamp without time zone. You did not say what timezone setting you are using, but I think the discrepancy is probably explained by that. regards, tom lane