From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Xavier Poinsard <xpoinsard(at)free(dot)fr> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Patch implementing escaped functions timestampadd and |
Date: | 2006-03-23 14:52:29 |
Message-ID: | DA86056F-C762-434C-825C-585831E5BE5D@fastcrypt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Xavier
The semantics of extract is that it will give the month/hour/minute
of the interval, not the number of months/hours/days of the interval
Dave
On 22-Mar-06, at 11:25 AM, Xavier Poinsard wrote:
> Dave Cramer a écrit :
>>> You are right, but I would not expect 0 with :
>>>
>>> select extract(month from
>>> (current_date+ interval '3 month'-current_date));
>>>
>>> date_part
>>> -----------
>>> 0
>>> (1 row)
>>
>>
>> This is still an interval basically you have
>>
>> date + interval - date which will be an interval. date - date is an
>> interval
>
> I think the interval implementation is bit deficient, since it only
> keeps one unit. Instead of keeping only the difference in days, it
> could
> have keep the information in month too.
>
> test=> select (current_date+interval '3 month'-current_date);
> ?column?
> ----------
> 92 days
> (1 row)
>
> test=> select extract(month from (interval '3 month'));
> date_part
> -----------
> 3
> (1 row)
>
> select extract(month from (interval '1 year'));
> date_part
> -----------
> 0
> (1 row)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Xavier Poinsard | 2006-03-24 12:03:11 | Re: Patch implementing escaped functions timestampadd and |
Previous Message | Xavier Poinsard | 2006-03-22 16:18:55 | Re: Patch implementing escaped functions timestampadd and |