Re: Time span conversion function

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: Time span conversion function
Дата
Msg-id 41E8B765.80601@blakjak.sytes.net
обсуждение исходный текст
Ответ на Re: Time span conversion function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Time span conversion function
Следующее
От: Greg Stark
Дата:
Сообщение: Re: sparse (static analyzer) report