Re: interval typmodout is broken - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: interval typmodout is broken
Date
Msg-id 20141018143122.GB16974@momjian.us
Whole thread Raw
In response to Re: interval typmodout is broken  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Mon, Oct 13, 2014 at 07:38:39PM -0400, Bruce Momjian wrote:
> I think the basic problem is that the original author had the idea of
> doing:
> 
>     SELECT INTERVAL (2) '100.9999 seconds';
>      interval
>     ----------
>      00:01:41
> 
> and using (2) in that location as a short-hand when the interval
> precision units were not specified, which seems logical.  However, they
> allowed it even when the units were specified:
> 
>     SELECT INTERVAL (2) '100.9999 seconds' HOUR to SECOND;
>      interval
>     ----------
>      00:01:41
> 
> and in cases where the precision made no sense:
>     
>     SELECT INTERVAL (2) '100.9999 seconds' HOUR to MINUTE;
>      interval
>     ----------
>      00:01:00
> 
> I have created the attached patch which only allows parentheses in the
> first case.  

Patch applied.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + Everyone has their own god. +



pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: get_actual_variable_range vs idx_scan/idx_tup_fetch
Next
From: Bruce Momjian
Date:
Subject: Re: get_actual_variable_range vs idx_scan/idx_tup_fetch