Re: interval typmodout is broken

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: interval typmodout is broken
Date: 2014-10-18 14:31:22
Message-ID: 20141018143122.GB16974@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-10-18 14:33:28 Re: get_actual_variable_range vs idx_scan/idx_tup_fetch
Previous Message Marko Tiikkaja 2014-10-18 14:29:41 Re: get_actual_variable_range vs idx_scan/idx_tup_fetch