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

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

From: Roy Badami <roy(at)gnomon(dot)org(dot)uk>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Roy Badami <roy(at)gnomon(dot)org(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month
Date: 2005-03-23 23:19:07
Message-ID: 16961.63851.854455.832219@giles.gnomon.org.uk (view raw or flat)
Thread:
Lists: pgsql-bugs
    Bruce> What happens if you store '13 months' into an interval
    Bruce> column that is YEAR TO MONTH?  Does extract MONTH return 1
    Bruce> or 13?

In  standard SQL  the  MONTH field  of  INTERVAL YEAR  TO MONTH  can't
contain a value  greater than 11.  Though I  don't immediately see how
you'd go about  storing 13 in the month field.   I don't think there's
an analogue of EXTRACT that allows you to set fields, is there?

    Bruce> The lack of complaints all these years perhaps means people
    Bruce> either don't care or accept the PG behavior.

To be honest, I don't really care :-)

I try to write my SQL in as standard a way as possible, in case I
later want to port to another database...

I would be perfectly happy for 

    INTERVAL '1' MONTH

to be a syntax error.  I just don't like the fact that it gives me a
zero interval.

Taking out the ISO support from the parser is a valid fix as far as
I'm concerned (though actually making it do the ISO thing would
obviously be nicer)

     -roy


In response to

pgsql-bugs by date

Next:From: Roy BadamiDate: 2005-03-23 23:26:48
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Previous:From: Tom LaneDate: 2005-03-23 23:07:56
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month and

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