Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 8BBB4474E44 for ; Mon, 25 Feb 2002 23:28:11 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g1Q4SFS27218; Mon, 25 Feb 2002 23:28:15 -0500 (EST) To: "Josh Berkus" Cc: pgsql-sql@postgresql.org Subject: Re: Timestamp operator error In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Mon, 25 Feb 2002 20:10:29 -0800" Date: Mon, 25 Feb 2002 23:28:14 -0500 Message-ID: <27215.1014697694@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200202/376 X-Sequence-Number: 6798 "Josh Berkus" writes: > Potentially a real problem bug in 7.2: > staffos=# select ('6 days'::INTERVAL + current_timestamp); > ?column? > --------------------- > 2002-02-25 00:00:00 > (1 row) Well, 7.1's not materially better: test71=# select ('6 days'::INTERVAL + current_timestamp); ?column? ---------- 23:15:27 (1 row) AFAICT, what's happening in 7.2 is that the closest-match operator is "time + date", so it casts the interval to time (yielding 0 hours), and casts current_timestamp to date (yielding midnight today) and adds. 7.1 evidently found some different, but equally unintuitive conversion path. Probably the difference in behavior is not the result of any algorithm change, but the addition or subtraction of a type-conversion operator. I suspect this is good ammunition for the argument I've made from time to time that we have too many implicit conversions, not too few. regards, tom lane