Re: BUG #1871: operations with data types

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, anris(at)polynet(dot)lviv(dot)ua, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1871: operations with data types
Date: 2005-09-16 19:39:38
Message-ID: 200509161939.j8GJdcQ22198@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Added to TODO:

o Fix SELECT INTERVAL '1' MONTH;

---------------------------------------------------------------------------

Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > I just noticed something in PostgreSQL that might be considered
> > surprising (although I do see "Add ISO INTERVAL handling" in the
> > TODO list):
>
> > test=> select interval '1' month;
> > interval
> > ----------
> > 00:00:00
> > (1 row)
>
> > What's the parser doing here?
>
> Not getting it right ;-). Trying this in historical versions is
> amusing:
>
> 7.0:
> regression=# select interval '1' month;
> ERROR: parser: parse error at or near "month"
>
> 7.1:
> regression=# select interval '1' month;
> ERROR: Bad interval external representation '1'
>
> 7.2:
> regression=# select interval '1' month;
> interval
> ----------
> 00:00
> (1 row)
>
> 7.3:
> regression=# select interval '1' month;
> interval
> ----------
> 00:00:01
> (1 row)
>
> 7.4 and up:
> regression=# select interval '1' month;
> interval
> ----------
> 00:00:00
> (1 row)
>
> What is happening in the current versions is that coerce_type thinks
> it can coerce the literal string to interval without supplying the
> modifier, and then use interval_scale() to apply the typmod. This
> works OK for most of the data types, but not for interval it seems...
>
> Basically the support for these weird syntaxes is something that Tom
> Lockhart never finished, and no one has bothered to pick up the work
> since he left the project.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Pablo Oses 2005-09-17 03:00:50 BUG #1888: bug in cast from float4 to float8
Previous Message Michael Fuhr 2005-09-16 16:31:53 Re: BUG #1862: ECPG Connect, host variable trailing blanks