From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Timestamp operator error
Date: Mon, 25 Feb 2002 23:28:14 -0500
Message-ID: <27215.1014697694@sss.pgh.pa.us> (raw)
In-Reply-To: <web-810117@davinci.ethosmedia.com>
References: <web-810117@davinci.ethosmedia.com>
"Josh Berkus" <josh@agliodbs.com> 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
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, josh@agliodbs.com
Subject: Re: Timestamp operator error
In-Reply-To: <27215.1014697694@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