Re: Patch for SQL-standard negative valued year-month literals - Mailing list pgsql-hackers

From Ron Mayer
Subject Re: Patch for SQL-standard negative valued year-month literals
Date
Msg-id 48D111E6.4090208@cheapcomplexdevices.com
Whole thread Raw
In response to Re: Patch for SQL-standard negative valued year-month literals  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> "Stephen R. van den Berg" <srb@cuci.nl> writes:
>> Intervals are a scalar, not an addition of assorted values, alternating signs
>> between fields would be wrong.
> 
> Sorry, you're the one who's wrong on that.  We've treated intervals as
> three independent fields for years now (and before that it was two
> independent fields).  We're not going to throw away that capability.

+1 It's very useful.

Currently our terse input format that's similar to the SQL standard
rejects more mixed-sign intervals than I'd like.  I'd be quite
happy if:  '1 2:03:-04'
gave me  '1 day 2 hours 3 minutes -4 seconds'
but currently we reject that mixed-sign-literal.


I'd just like to find a way to have SQL-standard input produce SQL-standard
output in the cases where the input happened to match the standard.

If we had a blank slate, my vote would be that  '-1 2:03:04'  should mean what the SQL standard says it should.  '-1
+2:03:04'should mean negative 1 days, plus 2 hours 3 minutes 4 sec  '1 2:03:-04'  should mean 1 day 2 hours 3 minutes
minus4 seconds  '-1 2:03:+04'  should mean negative 1 day 2 hours 3 minutes plus 4 seconds
 
but I'm aware that there are backward compatibility issues.


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Common Table Expressions (WITH RECURSIVE) patch
Next
From: Alvaro Herrera
Date:
Subject: Re: Autovacuum and Autoanalyze