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

Re: BUG #1518: Conversions to (undocumented) SQL year-month and

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month and
Date: 2005-03-23 22:48:56
Message-ID: 200503232248.j2NMmu425952@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Roy Badami wrote:
>     Bruce> Here is an email stating it is implementation defined:
> 
>     Bruce> 	http://archives.postgresql.org/pgsql-bugs/2005-03/msg00162.php
> 
> Hmm, looks like I'm mistaken, then.  In fact the "whether to truncate
> or round" bit suggests you should do one or the other, rather than
> raise an exception.
> 
> Will have to take a look at the spec when I get a moment...

OK, TODO updated:

        o Round or truncate values to the requested precision, e.g.
          INTERVAL '11 months' AS YEAR should return one or zero

The full TODO section is:

* Add ANSI INTERVAL handling
        o Add support for day-time syntax, INTERVAL '1 2:03:04'
          DAY TO SECOND
        o Add support for year-month syntax, INTERVAL '50-6' YEAR TO MONTH
        o Interpret syntax that isn't uniquely ANSI or PG, like '1:30' or
          '1' as ANSI syntax, e.g. interpret '1:30' MINUTE TO SECOND as
          '1 minute 30 seconds'
        o Interpret INTERVAL '1 year' MONTH as CAST (INTERVAL '1 year' AS
          INTERVAL MONTH), and this should return '12 months'
        o Round or truncate values to the requested precision, e.g.
          INTERVAL '11 months' AS YEAR should return one or zero
        o Support precision, CREATE TABLE foo (a INTERVAL MONTH(3))

-- 
  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-23 22:52:02
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month and
Previous:From: Roy BadamiDate: 2005-03-23 22:47:40
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,

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