Re: BUG #1518: Conversions to (undocumented) SQL year-month - Mailing list pgsql-bugs

From Roy Badami
Subject Re: BUG #1518: Conversions to (undocumented) SQL year-month
Date
Msg-id 16961.63851.854455.832219@giles.gnomon.org.uk
Whole thread Raw
In response to Re: BUG #1518: Conversions to (undocumented) SQL year-month  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1518: Conversions to (undocumented) SQL year-month and
Next
From: Roy Badami
Date:
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,