Skip site navigation (1) Skip section navigation (2)

Re: BUG #1517: SQL interval syntax is accepted by the parser,

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: Roy Badami <roy(at)gnomon(dot)org(dot)uk>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Date: 2005-03-24 18:22:51
Message-ID: 200503241822.j2OIMpi23984@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Tom Lane wrote:
> Roy Badami <roy(at)gnomon(dot)org(dot)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(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

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-03-24 18:42:58
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Previous:From: Ingolf KnopfDate: 2005-03-24 15:31:37
Subject: BUG #1561: wrong detection of number of parameters in java.sql.PreparedStatement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group