Re: BUG #1517: SQL interval syntax is accepted by the parser, - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date
Msg-id 200503241822.j2OIMpi23984@candle.pha.pa.us
Whole thread Raw
In response to Re: BUG #1517: SQL interval syntax is accepted by the parser,  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #1517: SQL interval syntax is accepted by the parser,
List pgsql-bugs
Tom Lane wrote:
> Roy Badami <roy@gnomon.org.uk> writes:
> >     test=> select interval '1 hour 1 minute';
> >      interval
> >     ----------
> >      01:01:00
> >     (1 row)
>
> > Hmm, I don't think I really like having a seconds field in the output,
> > given that the column is by definition only storing data to a
> > precision of a minute.
>
> Leaving out the seconds would make the display ambiguous.

Agreed.  What is really weird is that the time is always displayed for a
zero value:

    test=> select interval '0 years' year;
     interval
    ----------
     00:00:00
    (1 row)

but a non-zero shows the proper units:

    test=> select interval '1 years' year;
     interval
    ----------
     1 year
    (1 row)

Is that OK?

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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Next
From: Tom Lane
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,