"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