Re: Time span conversion function - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: Time span conversion function
Date
Msg-id 41E8B765.80601@blakjak.sytes.net
Whole thread Raw
In response to Re: Time span conversion function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

>Brendan Jurd <blakjak@blakjak.sytes.net> writes:
>  
>
>>Of course, it would be possible to create a shorthand version of the 
>>function which expects (text, interval), and passes directly to 
>>time_span($1, now(), $2).
>>    
>>
>
>This bothers me a bit.  That essentially says that (text, interval)
>has a hidden instability: the results depend on when you execute it.
>
>If we allow this form, it should be restricted to only those units
>(values of the text parameter) for which the result would *not*
>depend on now().
>  
>
mm, I see your point.  I suppose the only real reason to have the 
shorthand version is for people who want to test an interval value and 
don't particularly care what the startpoint is -- so they just use now() 
because it's a convenient way of getting a timestamp that satisfies the 
function.

To be honest, I'd be quite comfortable with dropping the shorthand 
version from the proposal.  If the caller has to type another 7 
characters, so be it.  It could fall under the "if you want it, define 
your own function for it" category.

BJ


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Time span conversion function
Next
From: Greg Stark
Date:
Subject: Re: sparse (static analyzer) report