Re: Patch for SQL-standard negative valued year-month literals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch for SQL-standard negative valued year-month literals
Date: 2008-09-16 22:36:27
Message-ID: 18956.1221604587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> Tom Lane wrote:
>> Hmm. I'm a bit concerned about possible side-effects on other cases:
>> what had been seen as two separate tokens will now become one token
>> for *all* datetime types, not just interval. However, I can't

> If it's a concern, I could make interval_in first look for the
> SQL-standard patterns before even parsing the string into fields.

I don't think it's worth the trouble unless someone points out a
real-world format that would be broken by the change. We certainly
don't document anything that would be. I've applied a patch along
these lines and we'll see if anyone complains.

> If I read SQL 200N's spec correctly

> select interval '-1 1:00:00';

> should mean "-1 days -1 hours",
> yet 8.3 sees it as "-1 days +1 hours".

I think we are kind of stuck on this one. If we change it, then how
would one represent -1 days +1 hours? The spec's format is only sane
if you assume all the fields must have the same sign, which is not
the case for PG.

> Scary to touch that one, but since a standard's a standard, I think
> eventually we should get there.

The SQL spec's date/time handling is, and always has been, broken enough
that I feel no great compulsion to follow every last detail. Especially
details that make it impossible to support our extensions...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-16 22:40:00 Re: Common Table Expressions (WITH RECURSIVE) patch
Previous Message Greg Stark 2008-09-16 22:23:38 Re: Common Table Expressions (WITH RECURSIVE) patch