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

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

Tom Lane wrote:
>> 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

I'm not proposing this, but I could imagine making
"-1 -1:00:00" and/or "-1 +1:00:00" mean -1 days +1 hours.

I think if it weren't for backward compatibility issues I'd even
support such an idea - since now we're oh-so-very-close to accepting
to-spec literals. Unfortunately I fear old users might assume the
opposite meaning.

>> 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...

In this case we're so very close to meeting the spec, though. And
it's ashame where we accept the to-spec syntax ("-1 1:00:00") but
return a different answer.

And since it's not quite impossible to support our extensions (force
putting the sign on the h:m:s part for mixed sign cases) I feels nice
to me to try.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-09-16 22:55:15 Re: Proposal of SE-PostgreSQL patches (for CommitFest:Sep)
Previous Message Tom Lane 2008-09-16 22:40:00 Re: Common Table Expressions (WITH RECURSIVE) patch