Re: Patch implementing escaped functions timestampadd and - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Patch implementing escaped functions timestampadd and
Date
Msg-id DA86056F-C762-434C-825C-585831E5BE5D@fastcrypt.com
Whole thread Raw
In response to Patch implementing escaped functions timestampadd and timestampdiff  ("Xavier Poinsard" <xpoinsard@free.fr>)
List 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)
>


pgsql-jdbc by date:

Previous
From: "Xavier Poinsard"
Date:
Subject: Re: Patch implementing escaped functions timestampadd and
Next
From: "Xavier Poinsard"
Date:
Subject: Re: Patch implementing escaped functions timestampadd and